remove peer "tries" system.
This commit is contained in:
parent
9b266c6ec7
commit
9476f7f70a
@ -116,12 +116,7 @@ function Pool(options) {
|
|||||||
// All peers
|
// All peers
|
||||||
all: [],
|
all: [],
|
||||||
// Misbehaving hosts
|
// Misbehaving hosts
|
||||||
misbehaving: {},
|
misbehaving: {}
|
||||||
// Attempts at using seed peers
|
|
||||||
tries: {
|
|
||||||
priority: {},
|
|
||||||
regular: {}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.block = {
|
this.block = {
|
||||||
@ -209,12 +204,6 @@ Pool.prototype._init = function _init() {
|
|||||||
|
|
||||||
// Only destroy peer here. Wait for higher chain.
|
// Only destroy peer here. Wait for higher chain.
|
||||||
peer.destroy();
|
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) {
|
this.chain.on('invalid', function(data, peer) {
|
||||||
@ -1556,10 +1545,6 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
|
|||||||
var original = this.originalSeeds;
|
var original = this.originalSeeds;
|
||||||
var seeds = this.seeds;
|
var seeds = this.seeds;
|
||||||
var all = original.concat(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.
|
// Hang back if we don't have a loader peer yet.
|
||||||
if (!connecting && !priority && (!this.peers.load || !this.peers.load.socket))
|
if (!connecting && !priority && (!this.peers.load || !this.peers.load.socket))
|
||||||
@ -1579,10 +1564,6 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
|
|||||||
continue;
|
continue;
|
||||||
if (this.isMisbehaving(addr.host))
|
if (this.isMisbehaving(addr.host))
|
||||||
continue;
|
continue;
|
||||||
if (tries[addr.host])
|
|
||||||
continue;
|
|
||||||
if (connecting)
|
|
||||||
tries[addr.host] = true;
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1596,10 +1577,6 @@ Pool.prototype.usableSeed = function usableSeed(priority, connecting) {
|
|||||||
continue;
|
continue;
|
||||||
if (this.isMisbehaving(addr.host))
|
if (this.isMisbehaving(addr.host))
|
||||||
continue;
|
continue;
|
||||||
if (tries[addr.host])
|
|
||||||
continue;
|
|
||||||
if (connecting)
|
|
||||||
tries[addr.host] = true;
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user