netaddress: fix fromHost.
This commit is contained in:
parent
ccd89e4f2f
commit
d7e2942117
@ -244,9 +244,11 @@ NetAddress.prototype.setPort = function setPort(port) {
|
|||||||
NetAddress.prototype.fromHost = function fromHost(host, port, network) {
|
NetAddress.prototype.fromHost = function fromHost(host, port, network) {
|
||||||
network = Network.get(network);
|
network = Network.get(network);
|
||||||
|
|
||||||
|
assert(port >= 0 && port <= 0xffff);
|
||||||
|
|
||||||
this.raw = IP.toBuffer(host);
|
this.raw = IP.toBuffer(host);
|
||||||
this.host = IP.toString(this.raw);
|
this.host = IP.toString(this.raw);
|
||||||
this.port = port || network.port;
|
this.port = port;
|
||||||
this.services = NetAddress.DEFAULT_SERVICES;
|
this.services = NetAddress.DEFAULT_SERVICES;
|
||||||
this.ts = network.now();
|
this.ts = network.now();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user