Browse Source

net: fix error details in connect()

3ac4941953 introduced a
bug as it attempted to access properties of an
undefined variable. This commit cleans up the offending
code.

Fixes: https://github.com/iojs/io.js/issues/510
PR-URL: https://github.com/iojs/io.js/pull/514
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v1.8.0-commit
cjihrig 10 years ago
parent
commit
e2558f02df
  1. 10
      lib/net.js

10
lib/net.js

@ -813,13 +813,13 @@ function connect(self, address, port, addressType, localAddress, localPort) {
}
if (err) {
self._getsockname();
var sockname = self._getsockname();
var details;
if (self._sockname) {
ex.localAddress = self._sockname.address;
ex.localPort = self._sockname.port;
details = ex.localAddress + ':' + ex.localPort;
if (sockname) {
details = sockname.address + ':' + sockname.port;
}
var ex = exceptionWithHostPort(err, 'connect', address, port, details);
self._destroy(ex);
}

Loading…
Cancel
Save