Skip to content

Commit

Permalink
net: remove unreachable check in internalConnect
Browse files Browse the repository at this point in the history
Checked all call-sites to ensure that this code is truly unreachable.
addressType is always checked before internalConnect is even called.

PR-URL: #24158
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
pipobscure authored and BridgeAR committed Nov 14, 2018
1 parent 22bfa31 commit 5f74436
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5f74436

Please sign in to comment.