mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-26 02:23:48 +01:00
Double check wired box
This commit is contained in:
parent
fdb6a22549
commit
9b06139f85
@ -35,7 +35,7 @@ function ConnectAPI() {
|
|||||||
var _numBoxesFound = 0; // count how many boxes responded
|
var _numBoxesFound = 0; // count how many boxes responded
|
||||||
var _boxes = {}; // current list of boxes
|
var _boxes = {}; // current list of boxes
|
||||||
var _numBoxes = 0; // current number of boxes
|
var _numBoxes = 0; // current number of boxes
|
||||||
|
var _checkedWiredBox = false;
|
||||||
var _self = this;
|
var _self = this;
|
||||||
|
|
||||||
this.list = function(completeHandler,failedHandler) {
|
this.list = function(completeHandler,failedHandler) {
|
||||||
@ -143,10 +143,22 @@ function ConnectAPI() {
|
|||||||
_numBoxesChecking++;
|
_numBoxesChecking++;
|
||||||
|
|
||||||
_networkAPI.alive(boxData.localip,_boxTimeoutTime,function() {
|
_networkAPI.alive(boxData.localip,_boxTimeoutTime,function() {
|
||||||
|
if(boxData.localip === _wiredBox.localip) {
|
||||||
|
// double check wired box (otherwise it shows up on switch to ap)
|
||||||
|
if(_checkedWiredBox) {
|
||||||
addBox(boxData);
|
addBox(boxData);
|
||||||
_numBoxesFound++;
|
_numBoxesFound++;
|
||||||
|
}
|
||||||
|
_checkedWiredBox = true;
|
||||||
|
} else {
|
||||||
|
addBox(boxData);
|
||||||
|
_numBoxesFound++;
|
||||||
|
}
|
||||||
}, function() {
|
}, function() {
|
||||||
removeBox(boxData.localip);
|
removeBox(boxData.localip);
|
||||||
|
if(boxData === _wiredBox) {
|
||||||
|
_checkedWiredBox = false;
|
||||||
|
}
|
||||||
},function(){
|
},function(){
|
||||||
_numBoxesChecking--;
|
_numBoxesChecking--;
|
||||||
if(_numBoxesChecking <= 0 && _listChanged && _self.listUpdated) {
|
if(_numBoxesChecking <= 0 && _listChanged && _self.listUpdated) {
|
||||||
|
Loading…
Reference in New Issue
Block a user