pool: refactor dns discovery.
This commit is contained in:
parent
aa07255d74
commit
b38d859382
@ -1568,7 +1568,7 @@ Pool.prototype._fillPeers = co(function* fillPeers() {
|
||||
if (this.hosts.size() < need) {
|
||||
this.logger.warning('Very few hosts available.');
|
||||
this.logger.warning('Hitting DNS seeds again.');
|
||||
yield this.hosts.discover(this.maxOutbound * 4);
|
||||
yield this.hosts.discover(30);
|
||||
}
|
||||
|
||||
for (i = 0; i < need; i++)
|
||||
@ -2338,21 +2338,22 @@ HostList.prototype.addSeed = function addSeed(hostname) {
|
||||
|
||||
/**
|
||||
* Discover hosts from seeds.
|
||||
* @param {Number?} max
|
||||
* @returns {Promise}
|
||||
*/
|
||||
|
||||
HostList.prototype.discover = co(function* discover(total) {
|
||||
HostList.prototype.discover = co(function* discover(max) {
|
||||
var i, seed;
|
||||
|
||||
if (!total)
|
||||
total = 16;
|
||||
if (!max)
|
||||
max = 16;
|
||||
|
||||
for (i = 0; i < this.seeds.length; i++) {
|
||||
seed = this.seeds[i];
|
||||
|
||||
yield this.populate(seed);
|
||||
|
||||
if (this.list.size >= total)
|
||||
if (this.list.size >= max)
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user