Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Revert "cluster: propagate bind errors"
Browse files Browse the repository at this point in the history
This reverts commit 30e462e.
  • Loading branch information
isaacs committed Feb 17, 2012
1 parent e16c6c7 commit 4b8c73a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 133 deletions.
24 changes: 6 additions & 18 deletions lib/net.js
Expand Up @@ -756,26 +756,14 @@ Server.prototype._listen2 = function(address, port, addressType) {


function listen(self, address, port, addressType) {
if (!process.env.NODE_WORKER_ID) {
if (process.env.NODE_WORKER_ID) {
require('cluster')._getServer(address, port, addressType, function(handle) {
self._handle = handle;
self._listen2(address, port, addressType);
});
} else {
self._listen2(address, port, addressType);
return;
}

require('cluster')._getServer(address, port, addressType, function(handle) {
// OS X doesn't necessarily signal EADDRINUSE from bind(), it may defer
// the error until later. libuv mimics this behaviour to provide
// consistent behaviour across platforms but that means we could very
// well have a socket that is not actually bound... that's why we do
// this ghetto port check and raise EADDRINUSE if the requested and the
// actual port differ except if port == 0 because that means "any port".
if (port && port != handle.getsockname().port) {
self.emit('error', errnoException('EADDRINUSE', 'bind'));
return;
}

self._handle = handle;
self._listen2(address, port, addressType);
});
}


Expand Down
115 changes: 0 additions & 115 deletions test/simple/test-cluster-bind-twice-v2.js

This file was deleted.

0 comments on commit 4b8c73a

Please sign in to comment.