From b215f19f6a1f9edc3ff8ea9d2c51f505224490b2 Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Mon, 29 Aug 2016 16:00:28 -0400 Subject: [PATCH] Fixed issue with context being lost, causing invalid mDNS discoveries --- static/js/index.js | 12 ++++++------ static/js/utils.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index 1e28114..6b4c7e0 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -63,18 +63,18 @@ function restoreUiAfterNaClLoad() { var ip = ips[i]; if (finder.byService_['_nvstream._tcp'][ip]) { var mDnsDiscoveredHost = new NvHTTP(ip, myUniqueid); - mDnsDiscoveredHost.pollServer(function() { + mDnsDiscoveredHost.pollServer(function(returneMdnsDiscoveredHost) { // Just drop this if the host doesn't respond - if (!mDnsDiscoveredHost.online) { + if (!returneMdnsDiscoveredHost.online) { return; } - if (hosts[mDnsDiscoveredHost.serverUid] != null) { + if (hosts[returneMdnsDiscoveredHost.serverUid] != null) { // if we're seeing a host we've already seen before, update it for the current local IP. - hosts[mDnsDiscoveredHost.serverUid].address = mDnsDiscoveredHost.address; + hosts[returneMdnsDiscoveredHost.serverUid].address = returneMdnsDiscoveredHost.address; } else { - beginBackgroundPollingOfHost(mDnsDiscoveredHost); - addHostToGrid(mDnsDiscoveredHost, true); + beginBackgroundPollingOfHost(returneMdnsDiscoveredHost); + addHostToGrid(returneMdnsDiscoveredHost, true); } }); } diff --git a/static/js/utils.js b/static/js/utils.js index 8bbe34b..eb554d6 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -119,13 +119,13 @@ NvHTTP.prototype = { this._consecutivePollFailures = 0; this.online = true; - onComplete(); + onComplete(this); }.bind(this), function() { if (++this._consecutivePollFailures >= 3) { this.online = false; } - onComplete(); + onComplete(this); }.bind(this)); },