allow specifying hostnames for udp/http individually

This commit is contained in:
Feross Aboukhadijeh 2015-05-03 20:29:58 -07:00
parent e7f0478e6e
commit 3eb0228c91

View File

@ -121,9 +121,9 @@ Server.prototype.listen = function (/* port, hostname, onlistening */) {
// ATTENTION: // ATTENTION:
// binding to :: only receives IPv4 connections if the bindv6only // binding to :: only receives IPv4 connections if the bindv6only
// sysctl is set 0, which is the default on many operating systems. // sysctl is set 0, which is the default on many operating systems.
if (self.http) self.http.listen(port.http || port, hostname || '::') if (self.http) self.http.listen(port.http || port, (hostname && hostname.http) || hostname || '::')
if (self.udp4) self.udp4.bind(port.udp || port, hostname) if (self.udp4) self.udp4.bind(port.udp || port, (hostname && hostname.udp) || hostname)
if (self.udp6) self.udp6.bind(port.udp || port, hostname) if (self.udp6) self.udp6.bind(port.udp || port, (hostname && hostname.udp) || hostname)
} }
Server.prototype.close = function (cb) { Server.prototype.close = function (cb) {