add back old peer seed code.
This commit is contained in:
parent
ef09a776fe
commit
9a60ae8e50
@ -1581,10 +1581,35 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try the rest of the peers second.
|
||||||
|
for (i = 0; i < seeds.length; i++) {
|
||||||
|
addr = seeds[i];
|
||||||
|
assert(addr.host);
|
||||||
|
if (this.getPeer(addr))
|
||||||
|
continue;
|
||||||
|
if (this.isMisbehaving(addr.host))
|
||||||
|
continue;
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we are a priority socket, try to find a
|
||||||
|
// peer this time with looser requirements.
|
||||||
|
if (priority) {
|
||||||
|
for (i = 0; i < seeds.length; i++) {
|
||||||
|
addr = seeds[i];
|
||||||
|
assert(addr.host);
|
||||||
|
if (this.peers.load && this.getPeer(addr) === this.peers.load)
|
||||||
|
continue;
|
||||||
|
if (this.isMisbehaving(addr.host))
|
||||||
|
continue;
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If we have no block peers, always return
|
// If we have no block peers, always return
|
||||||
// an address.
|
// an address.
|
||||||
if (!priority) {
|
if (!priority) {
|
||||||
if (connecting)
|
if (all.length === 1)
|
||||||
return all[Math.random() * (all.length - 1) | 0];
|
return all[Math.random() * (all.length - 1) | 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user