From 1100f3de7a2053d98f6ee81703df2d5bd17523d1 Mon Sep 17 00:00:00 2001 From: Eli Skeggs Date: Fri, 27 Jun 2014 22:32:50 -0700 Subject: net: don't emit listening if handle is closed Fixes #7834 Signed-off-by: Trevor Norris --- lib/net.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/net.js b/lib/net.js index 770f34ed4..eda9d84ad 100644 --- a/lib/net.js +++ b/lib/net.js @@ -1136,7 +1136,9 @@ Server.prototype._listen2 = function(address, port, addressType, backlog, fd) { this._connectionKey = addressType + ':' + address + ':' + port; process.nextTick(function() { - self.emit('listening'); + // ensure handle hasn't closed + if (self._handle) + self.emit('listening'); }); }; -- cgit v1.2.3