use of org.ethereum.net.client.PeerClient in project rskj by rsksmart.
the class SyncPool method connect.
private void connect(Node node, PeerClientFactory peerClientFactory) {
if (logger.isTraceEnabled()) {
logger.trace("Peer {}: initiate connection", node.getHexIdShort());
}
if (isInUse(node.getHexId())) {
if (logger.isTraceEnabled()) {
logger.trace("Peer {}: connection already initiated", node.getHexIdShort());
}
return;
}
synchronized (pendingConnections) {
String ip = node.getHost();
int port = node.getPort();
String remoteId = Hex.toHexString(node.getId().getID());
logger.info("Connecting to: {}:{}", ip, port);
PeerClient peerClient = peerClientFactory.newInstance();
peerClient.connectAsync(ip, port, remoteId, false);
pendingConnections.put(node.getHexId(), timeAfterMillis(CONNECTION_TIMEOUT));
}
}
use of org.ethereum.net.client.PeerClient in project rskj by rsksmart.
the class SyncPool method connect.
private void connect(Node node) {
if (logger.isTraceEnabled()) {
logger.trace("Peer {}: initiate connection", node.getHexId());
}
if (isInUse(node.getHexId())) {
if (logger.isTraceEnabled()) {
logger.trace("Peer {}: connection already initiated", node.getHexId());
}
return;
}
synchronized (pendingConnections) {
String ip = node.getHost();
int port = node.getPort();
String remoteId = ByteUtil.toHexString(node.getId().getID());
logger.info("Connecting to: {}:{}", ip, port);
PeerClient peerClient = peerClientFactory.newInstance();
peerClient.connectAsync(ip, port, remoteId);
pendingConnections.put(node.getHexId(), Instant.now());
}
}
Aggregations