netaddress: minor.

This commit is contained in:
Christopher Jeffrey 2016-12-19 04:19:16 -08:00
parent 546fccfca8
commit 9fd7153100
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -189,8 +189,11 @@ NetworkAddress.fromHost = function fromHost(host, port, network) {
NetworkAddress.prototype.fromHostname = function fromHostname(hostname, network) {
var addr;
network = Network.get(network);
addr = IP.parseHost(hostname, network.port);
return this.fromHost(addr.host, addr.port, network);
};
@ -239,14 +242,11 @@ NetworkAddress.fromSocket = function fromSocket(hostname, network) {
*/
NetworkAddress.prototype.fromReader = function fromReader(br, full) {
// only version >= 31402
this.ts = full ? br.readU32() : 0;
this.services = br.readU53();
this.host = IP.toString(br.readBytes(16));
this.host = IP.toString(br.readBytes(16, true));
this.port = br.readU16BE();
this.hostname = IP.hostname(this.host, this.port);
return this;
};