Search in sources :

Example 1 with NodesIpEvent

use of io.nuls.network.message.entity.NodesIpEvent in project nuls by nuls-io.

the class GetNodesIpEventHandler method process.

@Override
public NetworkEventResult process(BaseEvent event, Node node) {
    List<Node> availableNodes = getNetworkService().getAvailableNodes();
    List<String> ipList = new ArrayList<>();
    for (Node n : availableNodes) {
        ipList.add(n.getIp());
    }
    NodesIpEvent ipEvent = new NodesIpEvent(ipList);
    return new NetworkEventResult(true, ipEvent);
}
Also used : Node(io.nuls.network.entity.Node) ArrayList(java.util.ArrayList) NodesIpEvent(io.nuls.network.message.entity.NodesIpEvent) GetNodesIpEvent(io.nuls.network.message.entity.GetNodesIpEvent) NetworkEventResult(io.nuls.network.message.NetworkEventResult)

Aggregations

Node (io.nuls.network.entity.Node)1 NetworkEventResult (io.nuls.network.message.NetworkEventResult)1 GetNodesIpEvent (io.nuls.network.message.entity.GetNodesIpEvent)1 NodesIpEvent (io.nuls.network.message.entity.NodesIpEvent)1 ArrayList (java.util.ArrayList)1