From c1544a1bb38eba6e0937165737163e23dcef0f55 Mon Sep 17 00:00:00 2001 From: skilesare Date: Tue, 4 Feb 2014 10:07:27 -0600 Subject: [PATCH 1/2] Update portscanner.js Added Flipped the order of the check...sometime we don't care about an error if the status matches. In the case of looking for an port not in use we actually want the timeout to trip. --- lib/portscanner.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portscanner.js b/lib/portscanner.js index 1eb8345..4047230 100644 --- a/lib/portscanner.js +++ b/lib/portscanner.js @@ -115,13 +115,13 @@ function findAPortWithStatus(status, startPort, endPort, host, callback) { var checkNextPort = function(callback) { portscanner.checkPortStatus(port, host, function(error, statusOfPort) { numberOfPortsChecked++ - if (error) { - callback(error) - } - else if (statusOfPort === status) { + if (statusOfPort === status) { foundPort = true callback(null, port) } + else if (error) { + callback(error) + } else { port++ callback(null, false) From 3ed682ad7a88ec56bedd93a399b2688da9cb3585 Mon Sep 17 00:00:00 2001 From: skilesare Date: Tue, 4 Feb 2014 16:58:40 -0600 Subject: [PATCH 2/2] Update portscanner.js passing along error --- lib/portscanner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portscanner.js b/lib/portscanner.js index 4047230..fab9f13 100644 --- a/lib/portscanner.js +++ b/lib/portscanner.js @@ -117,7 +117,7 @@ function findAPortWithStatus(status, startPort, endPort, host, callback) { numberOfPortsChecked++ if (statusOfPort === status) { foundPort = true - callback(null, port) + callback(error, port) } else if (error) { callback(error)