Skip to content

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 4672872 commit a2851b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 210 deletions.
24 changes: 6 additions & 18 deletions lib/net.js
Original file line number Diff line number Diff line change
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
77 changes: 0 additions & 77 deletions test/simple/test-cluster-bind-twice-v1.js

This file was deleted.

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

This file was deleted.

0 comments on commit a2851b6

Please sign in to comment.