本文整理汇总了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();
}
示例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;
}
};
}
示例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();
}
示例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);