|
|
@ -1070,12 +1070,13 @@ function listen(self, address, port, addressType, backlog, fd) { |
|
|
|
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".
|
|
|
|
// 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; |
|
|
|