Search in sources :

Example 1 with OperationResult

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);
        }
    }
}
Also used : Node(org.ethereum.net.rlpx.Node) NodeID(co.rsk.net.NodeID) OperationResult(co.rsk.net.discovery.table.OperationResult)

Aggregations

NodeID (co.rsk.net.NodeID)1 OperationResult (co.rsk.net.discovery.table.OperationResult)1 Node (org.ethereum.net.rlpx.Node)1