diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-28 12:19:34 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-28 14:50:17 +0200 |
commit | 04f87de3da3b2fcc1367a1e97acf23485fb8c126 (patch) | |
tree | 3813cb642b7915c6c44b49e262d1918db654fdf6 /lib/dgram.js | |
parent | 2b569deed32d7f601e9c5af0415e842e1440d46e (diff) | |
download | nodejs-04f87de3da3b2fcc1367a1e97acf23485fb8c126.tar.gz nodejs-04f87de3da3b2fcc1367a1e97acf23485fb8c126.tar.bz2 nodejs-04f87de3da3b2fcc1367a1e97acf23485fb8c126.zip |
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.
Diffstat (limited to 'lib/dgram.js')
-rw-r--r-- | lib/dgram.js | 8 |
1 files changed, 7 insertions, 1 deletions
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(); |