pool: refactor dns discovery.
This commit is contained in:
parent
cc2d49ea10
commit
bd4bfa142f
@ -396,7 +396,8 @@ Pool.prototype._connect = co(function* connect() {
|
|||||||
this.logger.info('External IP found: %s.', ip);
|
this.logger.info('External IP found: %s.', ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
yield this.hosts.discover();
|
// Try to get 16 hosts for now.
|
||||||
|
yield this.hosts.discover(16);
|
||||||
|
|
||||||
if (this.hosts.size() === 0)
|
if (this.hosts.size() === 0)
|
||||||
throw new Error('No hosts available. Do you have an internet connection?');
|
throw new Error('No hosts available. Do you have an internet connection?');
|
||||||
@ -1565,10 +1566,10 @@ Pool.prototype._fillPeers = co(function* fillPeers() {
|
|||||||
this.peers.outbound,
|
this.peers.outbound,
|
||||||
this.maxOutbound);
|
this.maxOutbound);
|
||||||
|
|
||||||
if (this.hosts.size() < need) {
|
if (this.hosts.size() < need && need < 10) {
|
||||||
this.logger.warning('Very few hosts available.');
|
this.logger.warning('Very few hosts available.');
|
||||||
this.logger.warning('Hitting DNS seeds again.');
|
this.logger.warning('Hitting DNS seeds again.');
|
||||||
yield this.hosts.discover(30);
|
yield this.hosts.discover();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < need; i++)
|
for (i = 0; i < need; i++)
|
||||||
@ -2346,7 +2347,7 @@ HostList.prototype.discover = co(function* discover(max) {
|
|||||||
var i, seed;
|
var i, seed;
|
||||||
|
|
||||||
if (!max)
|
if (!max)
|
||||||
max = 16;
|
max = Infinity;
|
||||||
|
|
||||||
for (i = 0; i < this.seeds.length; i++) {
|
for (i = 0; i < this.seeds.length; i++) {
|
||||||
seed = this.seeds[i];
|
seed = this.seeds[i];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user