net: remove unreachable check in internalConnect

Checked all call-sites to ensure that this code is truly unreachable.
addressType is always checked before internalConnect is even called.

PR-URL: https://github.com/nodejs/node/pull/24158
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Philipp Dunkel 2018-11-06 15:25:35 +00:00 committed by Rich Trott
parent ad6ead3aab
commit ff566276da

View File

@ -830,12 +830,9 @@ function internalConnect(
if (addressType === 4) {
localAddress = localAddress || '0.0.0.0';
err = self._handle.bind(localAddress, localPort);
} else if (addressType === 6) {
} else { // addressType === 6
localAddress = localAddress || '::';
err = self._handle.bind6(localAddress, localPort);
} else {
self.destroy(new ERR_INVALID_ADDRESS_FAMILY(addressType));
return;
}
debug('binding to localAddress: %s and localPort: %d (addressType: %d)',
localAddress, localPort, addressType);