当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionInfo类代码示例

本文整理汇总了Java中org.telegram.mtproto.state.ConnectionInfo的典型用法代码示例。如果您正苦于以下问题:Java ConnectionInfo类的具体用法?Java ConnectionInfo怎么用?Java ConnectionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionInfo类属于org.telegram.mtproto.state包,在下文中一共展示了ConnectionInfo类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TransportRate

import org.telegram.mtproto.state.ConnectionInfo; //导入依赖的package包/类
public TransportRate(ConnectionInfo[] connectionInfos) {
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for (int i = 0; i < connectionInfos.length; i++) {
        min = Math.min(connectionInfos[i].getPriority(), min);
        max = Math.max(connectionInfos[i].getPriority(), max);
    }
    for (int i = 0; i < connectionInfos.length; i++) {
        this.transports.put(connectionInfos[i].getId(),
                new Transport(new ConnectionType(connectionInfos[i].getId(), connectionInfos[i].getAddress(), connectionInfos[i].getPort(), ConnectionType.TYPE_TCP),
                        connectionInfos[i].getPriority() - min + 1));
    }
    normalize();
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:15,代码来源:TransportRate.java

示例2: getMtProtoState

import org.telegram.mtproto.state.ConnectionInfo; //导入依赖的package包/类
@Override
public synchronized AbsMTProtoState getMtProtoState(final int dcId) {
    return new AbsMTProtoState() {

        private KnownSalt[] knownSalts = null;

        @Override
        public byte[] getAuthKey() {
            return MemoryApiState.this.getAuthKey(dcId);
        }

        @Override
        public ConnectionInfo[] getAvailableConnections() {
            return MemoryApiState.this.getAvailableConnections(dcId);
        }

        @Override
        public KnownSalt[] readKnownSalts() {
            if (knownSalts == null) {
                knownSalts = MemoryApiState.this.readKnownSalts(dcId);
            }
            return knownSalts;
        }

        @Override
        protected void writeKnownSalts(KnownSalt[] salts) {
            MemoryApiState.this.writeKnownSalts(dcId, salts);
            knownSalts = null;
        }
    };
}
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:32,代码来源:MemoryApiState.java

示例3: TransportRate

import org.telegram.mtproto.state.ConnectionInfo; //导入依赖的package包/类
public TransportRate(ConnectionInfo[] connectionInfos) {
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for (int i = 0; i < connectionInfos.length; i++) {
        min = Math.min(connectionInfos[i].getPriority(), min);
        max = Math.max(connectionInfos[i].getPriority(), max);
    }
    for (int i = 0; i < connectionInfos.length; i++) {
        transports.put(connectionInfos[i].getId(),
                new Transport(new ConnectionType(connectionInfos[i].getId(), connectionInfos[i].getAddress(), connectionInfos[i].getPort(), ConnectionType.TYPE_TCP),
                        connectionInfos[i].getPriority() - min + 1));
    }
    normalize();
}
 
开发者ID:ardock,项目名称:telegram-mt,代码行数:15,代码来源:TransportRate.java

示例4: getAvailableConnections

import org.telegram.mtproto.state.ConnectionInfo; //导入依赖的package包/类
/**
 * Get available connections.
 *
 * @param dcId the dc id
 * @return the connection info [ ]
 */
ConnectionInfo[] getAvailableConnections(int dcId);
 
开发者ID:rubenlagus,项目名称:TelegramApi,代码行数:8,代码来源:AbsApiState.java


注:本文中的org.telegram.mtproto.state.ConnectionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。