From 91e745b8493bfda36351172cedc38c24da5595f1 Mon Sep 17 00:00:00 2001 From: HipsterBrown Date: Sun, 16 Apr 2017 20:50:44 -0400 Subject: [PATCH] fix(wifi): resolve infinite loop of tries --- lib/tessel/wifi.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/tessel/wifi.js b/lib/tessel/wifi.js index c425965e..5544a3f7 100644 --- a/lib/tessel/wifi.js +++ b/lib/tessel/wifi.js @@ -121,7 +121,9 @@ Tessel.prototype.connectToNetwork = function(opts) { if (password && security) { status += `, password: ${password}, security: ${security}`; - } else if (!password && (!security || security === 'none')) { + } + + if (!password && !security) { security = 'none'; } @@ -213,7 +215,8 @@ Tessel.prototype.setWiFiState = function(enable) { } this.receive(remoteProcess, (err, result) => { if (err) { - if (err.toString().includes('Not found')) { + if (err.toString().includes('Not found') && tries) { + tries--; return pollForWifiSignal(); } else { return reject(err);