From 2d0105c751b37ecb133ee936f8eb74190b919cbf Mon Sep 17 00:00:00 2001 From: Philipp Dunkel Date: Tue, 6 Nov 2018 15:25:35 +0000 Subject: [PATCH] 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 Reviewed-By: Ruben Bridgewater --- lib/net.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/net.js b/lib/net.js index 35bfd33eaaf473..30cad781bfe134 100644 --- a/lib/net.js +++ b/lib/net.js @@ -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);