Reused addrToBytes
This commit is contained in:
parent
aff1784327
commit
ad5323cfaa
@ -119,13 +119,9 @@ public class Node {
|
||||
Ack ack = generateAck(neighbor);
|
||||
buffer.put(MessageType.NEW_NEIGHBOR);
|
||||
buffer.putInt(ack.getId());
|
||||
InetSocketAddress a = (InetSocketAddress) neighbor;
|
||||
|
||||
for (String part : a.getHostString().split("\\.")) {
|
||||
buffer.put(Byte.valueOf(part));
|
||||
}
|
||||
|
||||
buffer.putInt(a.getPort());
|
||||
byte[] addr = addrToBytes((InetSocketAddress) neighbor);
|
||||
buffer.put(addr);
|
||||
buffer.flip();
|
||||
|
||||
ack.setBuf(BufferUtil.clone(buffer));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user