From 9b06139f856fb608685a9279c199d39f38067557 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Mon, 12 May 2014 16:54:16 +0200 Subject: [PATCH] Double check wired box --- js/api/ConnectAPI.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/js/api/ConnectAPI.js b/js/api/ConnectAPI.js index 605de86..a81ce58 100644 --- a/js/api/ConnectAPI.js +++ b/js/api/ConnectAPI.js @@ -35,7 +35,7 @@ function ConnectAPI() { var _numBoxesFound = 0; // count how many boxes responded var _boxes = {}; // current list of boxes var _numBoxes = 0; // current number of boxes - + var _checkedWiredBox = false; var _self = this; this.list = function(completeHandler,failedHandler) { @@ -143,10 +143,22 @@ function ConnectAPI() { _numBoxesChecking++; _networkAPI.alive(boxData.localip,_boxTimeoutTime,function() { - addBox(boxData); - _numBoxesFound++; + if(boxData.localip === _wiredBox.localip) { + // double check wired box (otherwise it shows up on switch to ap) + if(_checkedWiredBox) { + addBox(boxData); + _numBoxesFound++; + } + _checkedWiredBox = true; + } else { + addBox(boxData); + _numBoxesFound++; + } }, function() { removeBox(boxData.localip); + if(boxData === _wiredBox) { + _checkedWiredBox = false; + } },function(){ _numBoxesChecking--; if(_numBoxesChecking <= 0 && _listChanged && _self.listUpdated) {