pool: keep hostname on net addr.
This commit is contained in:
parent
9ed67e0695
commit
159679e5eb
@ -794,6 +794,7 @@ function NetworkAddress(options) {
|
||||
this.port = 0;
|
||||
this.services = 0;
|
||||
this.ts = 0;
|
||||
this.hostname = '0.0.0.0:0';
|
||||
|
||||
if (options)
|
||||
this.fromOptions(options);
|
||||
@ -835,6 +836,8 @@ NetworkAddress.prototype.fromOptions = function fromOptions(options) {
|
||||
this.ts = options.ts;
|
||||
}
|
||||
|
||||
this.hostname = IP.hostname(this.host, this.port);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -926,6 +929,8 @@ NetworkAddress.prototype.fromHostname = function fromHostname(hostname, network)
|
||||
| constants.services.WITNESS;
|
||||
this.ts = bcoin.now();
|
||||
|
||||
this.hostname = IP.hostname(this.host, this.port);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -961,6 +966,8 @@ NetworkAddress.prototype.fromRaw = function fromRaw(data, full) {
|
||||
if (this.ts <= 100000000 || this.ts > now + 10 * 60)
|
||||
this.ts = now - 5 * 24 * 60 * 60;
|
||||
|
||||
this.hostname = IP.hostname(this.host, this.port);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
@ -171,6 +171,7 @@ Pool.prototype._initOptions = function _initOptions() {
|
||||
this.address.ts = utils.now();
|
||||
this.address.services = this.services;
|
||||
this.address.port = this.port;
|
||||
this.address.hostname = IP.hostname(this.address.host, this.port);
|
||||
|
||||
if (this.options.maxPeers != null)
|
||||
this.maxPeers = this.options.maxPeers;
|
||||
@ -320,6 +321,7 @@ Pool.prototype._open = function _open(callback) {
|
||||
|
||||
if (ip) {
|
||||
self.address.host = ip;
|
||||
self.address.hostname = IP.hostname(ip, self.address.port);
|
||||
self.logger.info('External IP found: %s.', ip);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user