use of io.nuls.network.message.entity.NodeEvent in project nuls by nuls-io.
the class GetNodeEventHandler method process.
@Override
public NetworkEventResult process(BaseEvent event, Node node) {
GetNodeEvent getNodeEvent = (GetNodeEvent) event;
// String key = event.getHeader().getEventType() + "-" + node.getIp();
// if (cacheService.existEvent(key)) {
// getNetworkService().removeNode(node.getId());
// return null;
// }
// cacheService.putEvent(key, event, false);
List<Node> list = getAvailableNodes(getNodeEvent.getLength(), node.getId());
NodeEvent replyEvent = new NodeEvent(list);
return new NetworkEventResult(true, replyEvent);
}
use of io.nuls.network.message.entity.NodeEvent in project nuls by nuls-io.
the class NodeEventHandler method process.
@Override
public NetworkEventResult process(BaseEvent networkEvent, Node node) {
NodeEvent event = (NodeEvent) networkEvent;
for (Node newNode : event.getEventBody().getNodes()) {
newNode.setType(Node.OUT);
newNode.setStatus(Node.WAIT);
getNetworkService().addNodeToGroup(NetworkConstant.NETWORK_NODE_OUT_GROUP, newNode);
}
return null;
}
Aggregations