Skip to content

Commit

Permalink
src: lint lib/net.js
Browse files Browse the repository at this point in the history
  • Loading branch information
tjfontaine committed Jan 23, 2014
1 parent bc2f31a commit b0e5f19
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -1064,26 +1064,27 @@ function listen(self, address, port, addressType, backlog, fd) {

cluster._getServer(self, address, port, addressType, fd, function(handle,
err) {
// EACCESS and friends
if (err) {
self.emit('error', errnoException(err, 'bind'));
return;
}

// Some operating systems (notably OS X and Solaris) don't report EADDRINUSE
// errors right away. libuv mimics that behavior for the sake of platform
// consistency but that means we have have a socket on our hands that is
// not actually bound. That's why we check if the actual port matches what
// we requested and if not, raise an error. The exception is when port == 0
// because that means "any random port".
if (port && handle.getsockname && port != handle.getsockname().port) {
self.emit('error', errnoException('EADDRINUSE', 'bind'));
return;
}

self._handle = handle;
self._listen2(address, port, addressType, backlog, fd);
});
// EACCESS and friends
if (err) {
self.emit('error', errnoException(err, 'bind'));
return;
}

// Some operating systems (notably OS X and Solaris) don't report
// EADDRINUSE errors right away. libuv mimics that behavior for the
// sake of platform consistency but that means we have have a socket on
// our hands that is not actually bound. That's why we check if the
// actual port matches what we requested and if not, raise an error.
// The exception is when port == 0 because that means "any random
// port".
if (port && handle.getsockname && port != handle.getsockname().port) {
self.emit('error', errnoException('EADDRINUSE', 'bind'));
return;
}

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


Expand Down

0 comments on commit b0e5f19

Please sign in to comment.