int processed = 0, dropped = 0;
int processed = 0, dropped = 0;
processor.submit(() -> node.preProcessReceivedData(bytes, address, "udp"));
processor.submit(() -> node.preProcessReceivedData(bytes, address, "udp"));
existingNeighbor = false;
List neighbors = node.getNeighbors();
neighbors.stream().filter(n -> n instanceof TCPNeighbor)
.map(n -> ((TCPNeighbor) n))
.forEach(n -> {
String hisAddress = inet_socket_address.getAddress().getHostAddress();
if (n.getHostAddress().equals(hisAddress)) {
existingNeighbor = true;
neighbor = n;
}
}
);
existingNeighbor = false;
List neighbors = node.getNeighbors();
neighbors.stream().filter(n -> n instanceof TCPNeighbor)
.map(n -> ((TCPNeighbor) n))
.forEach(n -> {
String hisAddress = inet_socket_address.getAddress().getHostAddress();
if (n.getHostAddress().equals(hisAddress)) {
existingNeighbor = true;
neighbor = n;
}
}
);
final TCPNeighbor fresh_neighbor = new TCPNeighbor(inet_socket_address,false);
node.getNeighbors().add(fresh_neighbor);
neighbor = fresh_neighbor;
Neighbor.incNumPeers();
final TCPNeighbor fresh_neighbor = new TCPNeighbor(inet_socket_address,false);
node.getNeighbors().add(fresh_neighbor);
neighbor = fresh_neighbor;
Neighbor.incNumPeers();
offset = 0;
while (((count = stream.read(data, offset, ReplicatorSinkPool.PORT_BYTES - offset)) != -1) && (offset
Thread exit, if the first 10 bytes of the payload received is not the listener service port or connection is closed. The port value received will be used by the ReplicatorSinkProcessor thread to send information back to peer.
The final section of this thread focuses on ensuring proper payload was sent. The full payload in proper order is 10 bytes (peer listener port), 1650 bytes (main payload), and 16 bytes (checksum). The data received is unpacked, checksum validated for main payload, and then submitted to com.iota.iri.network.Node::preProcessReceivedData method for processing.
if (!crcError) {
node.preProcessReceivedData(data, address, "tcp");
}
offset = 0;
while (((count = stream.read(data, offset, ReplicatorSinkPool.PORT_BYTES - offset)) != -1) && (offset < ReplicatorSinkPool.PORT_BYTES)) {
offset += count;
}
Thread exit, if the first 10 bytes of the payload received is not the listener service port or connection is closed. The port value received will be used by the ReplicatorSinkProcessor thread to send information back to peer.
The final section of this thread focuses on ensuring proper payload was sent. The full payload in proper order is 10 bytes (peer listener port), 1650 bytes (main payload), and 16 bytes (checksum). The data received is unpacked, checksum validated for main payload, and then submitted to com.iota.iri.network.Node::preProcessReceivedData method for processing.
if (!crcError) {
node.preProcessReceivedData(data, address, "tcp");
}