src: lint lib/net.js
This commit is contained in:
parent
bc2f31ae1d
commit
b0e5f195df
37
lib/net.js
37
lib/net.js
@ -1064,26 +1064,27 @@ function listen(self, address, port, addressType, backlog, fd) {
|
|||||||
|
|
||||||
cluster._getServer(self, address, port, addressType, fd, function(handle,
|
cluster._getServer(self, address, port, addressType, fd, function(handle,
|
||||||
err) {
|
err) {
|
||||||
// EACCESS and friends
|
// EACCESS and friends
|
||||||
if (err) {
|
if (err) {
|
||||||
self.emit('error', errnoException(err, 'bind'));
|
self.emit('error', errnoException(err, 'bind'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some operating systems (notably OS X and Solaris) don't report EADDRINUSE
|
// Some operating systems (notably OS X and Solaris) don't report
|
||||||
// errors right away. libuv mimics that behavior for the sake of platform
|
// EADDRINUSE errors right away. libuv mimics that behavior for the
|
||||||
// consistency but that means we have have a socket on our hands that is
|
// sake of platform consistency but that means we have have a socket on
|
||||||
// not actually bound. That's why we check if the actual port matches what
|
// our hands that is not actually bound. That's why we check if the
|
||||||
// we requested and if not, raise an error. The exception is when port == 0
|
// actual port matches what we requested and if not, raise an error.
|
||||||
// because that means "any random port".
|
// The exception is when port == 0 because that means "any random
|
||||||
if (port && handle.getsockname && port != handle.getsockname().port) {
|
// port".
|
||||||
self.emit('error', errnoException('EADDRINUSE', 'bind'));
|
if (port && handle.getsockname && port != handle.getsockname().port) {
|
||||||
return;
|
self.emit('error', errnoException('EADDRINUSE', 'bind'));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self._handle = handle;
|
self._handle = handle;
|
||||||
self._listen2(address, port, addressType, backlog, fd);
|
self._listen2(address, port, addressType, backlog, fd);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user