From 1458c26a1a413857f785340d38ab36ade15c644a Mon Sep 17 00:00:00 2001 From: Philipp Dunkel Date: Tue, 6 Nov 2018 15:25:35 +0000 Subject: [PATCH 1/2] 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. --- lib/net.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/net.js b/lib/net.js index 05fc4fa9598b04..be393538cdcc7c 100644 --- a/lib/net.js +++ b/lib/net.js @@ -842,9 +842,6 @@ function internalConnect( } else if (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); From 805cbe91774fab161592e6af9fa904700e43be95 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 13 Nov 2018 16:32:04 +0000 Subject: [PATCH 2/2] Update lib/net.js Co-Authored-By: pipobscure --- lib/net.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net.js b/lib/net.js index be393538cdcc7c..d418245ea659be 100644 --- a/lib/net.js +++ b/lib/net.js @@ -839,7 +839,7 @@ 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); }