From 2154a3ce0f2eca1d26e1ad8e7bbeae1039822a5a Mon Sep 17 00:00:00 2001 From: Brian White Date: Mon, 24 Apr 2017 02:27:14 -0400 Subject: [PATCH] net: move debug statement This will allow `localAddress` to be properly set before writing debug output. PR-URL: https://github.com/nodejs/node/pull/12616 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater --- lib/net.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/net.js b/lib/net.js index 4cd2cf6bc2833f..5cf404b49cd9c5 100644 --- a/lib/net.js +++ b/lib/net.js @@ -887,9 +887,6 @@ function internalConnect( var err; if (localAddress || localPort) { - debug('binding to localAddress: %s and localPort: %d (addressType: %d)', - localAddress, localPort, addressType); - if (addressType === 4) { localAddress = localAddress || '0.0.0.0'; err = self._handle.bind(localAddress, localPort); @@ -900,6 +897,8 @@ function internalConnect( self.destroy(new TypeError('Invalid addressType: ' + addressType)); return; } + debug('binding to localAddress: %s and localPort: %d (addressType: %d)', + localAddress, localPort, addressType); if (err) { const ex = exceptionWithHostPort(err, 'bind', localAddress, localPort);