use of co.rsk.net.discovery.table.OperationResult in project rskj by rsksmart.
the class PeerExplorer method addConnection.
private void addConnection(PongPeerMessage message, String ip, int port) {
Node senderNode = new Node(message.getNodeId().getID(), ip, port);
if (!StringUtils.equals(senderNode.getHexId(), this.localNode.getHexId())) {
OperationResult result = this.distanceTable.addNode(senderNode);
if (result.isSuccess()) {
NodeID senderId = senderNode.getId();
this.establishedConnections.put(senderId, senderNode);
logger.debug("New Peer found ip:[{}] port[{}]", ip, port);
} else {
this.challengeManager.startChallenge(result.getAffectedEntry().getNode(), senderNode, this);
}
}
}
Aggregations