From 04f87de3da3b2fcc1367a1e97acf23485fb8c126 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 28 Jul 2013 12:19:34 +0200 Subject: cluster: fix shared handle bind error propagation A failed bind() was already being correctly reported in round-robin mode. This commit fixes bind() error reporting in shared handle mode. Fixes #5774. --- lib/dgram.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/dgram.js') diff --git a/lib/dgram.js b/lib/dgram.js index 1ac5c27c3..de0675fb0 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -191,7 +191,13 @@ Socket.prototype.bind = function(/*port, address, callback*/) { cluster = require('cluster'); if (cluster.isWorker) { - cluster._getServer(self, ip, port, self.type, -1, function(handle) { + cluster._getServer(self, ip, port, self.type, -1, function(err, handle) { + if (err) { + self.emit('error', errnoException(err, 'bind')); + self._bindState = BIND_STATE_UNBOUND; + return; + } + if (!self._handle) // handle has been closed in the mean time. return handle.close(); -- cgit v1.2.3