netaddress: fix fromHost.

This commit is contained in:
Christopher Jeffrey 2017-03-11 21:22:58 -08:00
parent ccd89e4f2f
commit d7e2942117
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -244,9 +244,11 @@ NetAddress.prototype.setPort = function setPort(port) {
NetAddress.prototype.fromHost = function fromHost(host, port, network) {
network = Network.get(network);
assert(port >= 0 && port <= 0xffff);
this.raw = IP.toBuffer(host);
this.host = IP.toString(this.raw);
this.port = port || network.port;
this.port = port;
this.services = NetAddress.DEFAULT_SERVICES;
this.ts = network.now();