remove peer "tries" system.

This commit is contained in:
Christopher Jeffrey 2016-01-22 18:09:26 -08:00
parent 9b266c6ec7
commit 9476f7f70a

View File

@ -116,12 +116,7 @@ function Pool(options) {
// All peers
all: [],
// Misbehaving hosts
misbehaving: {},
// Attempts at using seed peers
tries: {
priority: {},
regular: {}
}
misbehaving: {}
};
this.block = {
@ -209,12 +204,6 @@ Pool.prototype._init = function _init() {
// Only destroy peer here. Wait for higher chain.
peer.destroy();
// Remove the peers from the tried list after 5 seconds.
setTimeout(function() {
delete self.peers.tries.priority[peer.host];
delete self.peers.tries.regular[peer.host];
}, 5 * 1000);
});
this.chain.on('invalid', function(data, peer) {
@ -1556,10 +1545,6 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
var original = this.originalSeeds;
var seeds = this.seeds;
var all = original.concat(seeds);
var tries = this.peers.tries.regular;
if (priority)
tries = this.peers.tries.priority;
// Hang back if we don't have a loader peer yet.
if (!connecting && !priority && (!this.peers.load || !this.peers.load.socket))
@ -1579,10 +1564,6 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
continue;
if (this.isMisbehaving(addr.host))
continue;
if (tries[addr.host])
continue;
if (connecting)
tries[addr.host] = true;
return addr;
}
@ -1596,10 +1577,6 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
continue;
if (this.isMisbehaving(addr.host))
continue;
if (tries[addr.host])
continue;
if (connecting)
tries[addr.host] = true;
return addr;
}
}