Search in sources :

Example 6 with INode

use of org.aion.p2p.INode in project aion by aionnetwork.

the class NodeMgr method updateAllNodesInfo.

public void updateAllNodesInfo(INode _n) {
    Node n = (Node) _n;
    if (n.hasFullInfo()) {
        int fullHash = n.getFullHash();
        if (allNodes.containsKey(fullHash)) {
            Node orig = allNodes.get(fullHash);
            // pull out metric.
            orig.copyNodeStatus(n);
        }
    }
}
Also used : INode(org.aion.p2p.INode)

Example 7 with INode

use of org.aion.p2p.INode in project aion by aionnetwork.

the class ResActiveNodes method encode.

@Override
public byte[] encode() {
    ByteBuffer buf = ByteBuffer.allocate(NODE_BYTES_LENGTH * this.count + 1);
    buf.put((byte) this.count);
    for (INode n : this.nodes) {
        buf.put(n.getId());
        buf.put(n.getIp());
        buf.putInt(n.getPort());
    }
    return buf.array();
}
Also used : INode(org.aion.p2p.INode) ByteBuffer(java.nio.ByteBuffer)

Aggregations

INode (org.aion.p2p.INode)7 BigInteger (java.math.BigInteger)3 ByteBuffer (java.nio.ByteBuffer)2 java.util (java.util)2 Collectors (java.util.stream.Collectors)2 ByteString (com.google.protobuf.ByteString)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 Entry (java.util.Map.Entry)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 LongStream (java.util.stream.LongStream)1 ApiAion (org.aion.api.server.ApiAion)1 ApiUtil (org.aion.api.server.ApiUtil)1 IApiAion (org.aion.api.server.IApiAion)1 org.aion.api.server.types (org.aion.api.server.types)1 org.aion.base.type (org.aion.base.type)1 ByteArrayWrapper (org.aion.base.util.ByteArrayWrapper)1 ByteUtil (org.aion.base.util.ByteUtil)1 Hex (org.aion.base.util.Hex)1 TypeConverter (org.aion.base.util.TypeConverter)1 EquihashMiner (org.aion.equihash.EquihashMiner)1