peer: style fixes.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
parent
5c5762a000
commit
2edfdd8b36
@ -355,7 +355,8 @@ Peer.prototype._handleGetAddr = function handleGetAddr() {
|
||||
port: peer.socket.remotePort || 8333
|
||||
};
|
||||
}).filter(function(peer) {
|
||||
if (!peer || ~used.indexOf(peer.host)) return;
|
||||
if (!peer || ~used.indexOf(peer.host))
|
||||
return;
|
||||
used.push(peer.host);
|
||||
return !!peer.host && net.isIP(peer.host);
|
||||
}).map(function(peer) {
|
||||
@ -371,12 +372,10 @@ Peer.prototype._handleGetAddr = function handleGetAddr() {
|
||||
|
||||
peers = peers.map(function(peer) {
|
||||
if (peer.ver === 6) {
|
||||
while (peer.ipv6.split(':').length < 8) {
|
||||
while (peer.ipv6.split(':').length < 8)
|
||||
peer.ipv6 = '0000:' + peer.ipv6;
|
||||
}
|
||||
if (peer.ipv6.split(':').length > 8) {
|
||||
if (peer.ipv6.split(':').length > 8)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
peer.ipv4 = peer.ipv4.split('.').map(function(n) {
|
||||
|
||||
@ -111,12 +111,10 @@ function varint(arr, value, off) {
|
||||
arr[off + 3] = (value >>> 16) & 0xff;
|
||||
arr[off + 4] = value >>> 24;
|
||||
return 5;
|
||||
} else if (peers.length <= 0xffffffffffffffff) {
|
||||
} else {
|
||||
p[off] = 0xff;
|
||||
utils.writeU64(arr, value, off + 1);
|
||||
return 9;
|
||||
} else {
|
||||
throw new Error('>64bit varint not supported yet');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user