cleanup old tries code.

This commit is contained in:
Christopher Jeffrey 2016-01-22 18:10:14 -08:00
parent 9476f7f70a
commit ef09a776fe

View File

@ -1581,35 +1581,10 @@ 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
// an address.
if (!priority) {
if (all.length === 1)
if (connecting)
return all[Math.random() * (all.length - 1) | 0];
}