From 04eab4716cf55b7f6587ad75164fd1dbcc95281e Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel Date: Mon, 27 May 2013 14:49:44 -0600 Subject: [PATCH] allow binding ldap server on an ephemeral port --- lib/server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index da64af4..2853582 100644 --- a/lib/server.js +++ b/lib/server.js @@ -651,7 +651,7 @@ Server.prototype.after = function () { // All these just reexpose the requisite net.Server APIs Server.prototype.listen = function (port, host, callback) { - if (!port) + if (typeof port !== 'number') throw new TypeError('port (number) required'); if (typeof (host) === 'function') { @@ -662,8 +662,8 @@ Server.prototype.listen = function (port, host, callback) { function _callback() { if (typeof (port) === 'number') { - self.host = host; - self.port = port; + self.host = self.address().address; + self.port = self.address().port; } else { self.host = port; self.port = self.server.fd;