Browse Source

Revert "Cluster: fix shared handles on Windows"

This reverts commit 4e68a28e20.
archived-io.js-v0.10
Fedor Indutny 11 years ago
parent
commit
ff6117b8ed
  1. 18
      lib/net.js

18
lib/net.js

@ -1080,6 +1080,17 @@ var createServerHandle = exports._createServerHandle =
return err; return err;
} }
if (process.platform === 'win32') {
// On Windows, we always listen to the socket before sending it to
// the worker (see uv_tcp_duplicate_socket). So we better do it here
// so that we can handle any bind-time or listen-time errors early.
err = _listen(handle);
if (err) {
handle.close();
return err;
}
}
return handle; return handle;
}; };
@ -1088,6 +1099,8 @@ Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
debug('listen2', address, port, addressType, backlog); debug('listen2', address, port, addressType, backlog);
var self = this; var self = this;
var alreadyListening = false;
// If there is not yet a handle, we need to create one and bind. // If there is not yet a handle, we need to create one and bind.
// In the case of a server sent via IPC, we don't need to do this. // In the case of a server sent via IPC, we don't need to do this.
if (!self._handle) { if (!self._handle) {
@ -1100,6 +1113,7 @@ Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
}); });
return; return;
} }
alreadyListening = (process.platform === 'win32');
self._handle = rval; self._handle = rval;
} else { } else {
debug('_listen2: have a handle already'); debug('_listen2: have a handle already');
@ -1108,7 +1122,9 @@ Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
self._handle.onconnection = onconnection; self._handle.onconnection = onconnection;
self._handle.owner = self; self._handle.owner = self;
var err = _listen(self._handle, backlog); var err = 0;
if (!alreadyListening)
err = _listen(self._handle, backlog);
if (err) { if (err) {
var ex = errnoException(err, 'listen'); var ex = errnoException(err, 'listen');

Loading…
Cancel
Save