From e39c708bf6a2ba8b7f506c4085f6b70cc2cd907e Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 7 Jun 2016 11:10:48 -0700 Subject: [PATCH] require two triggers for API refresh, fix check for ICE domain --- libraries/networking/src/DomainHandler.cpp | 3 ++- libraries/networking/src/NodeList.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index 9b94c07ed2..74e38a5003 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -166,7 +166,8 @@ void DomainHandler::setSocketAndID(const QString& hostname, quint16 port, const } void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname, const QUuid& id) { - if (_iceServerSockAddr.getAddress().toString() != iceServerHostname && id != _pendingDomainID) { + + if (_iceServerSockAddr.getAddress().toString() != iceServerHostname || id != _pendingDomainID) { // re-set the domain info to connect to new domain hardReset(); diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 41cfe2cfd7..adb6c8e13e 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -356,19 +356,22 @@ void NodeList::sendDomainServerCheckIn() { _numNoReplyDomainCheckIns++; } - const int NUM_NO_REPLY_CHECKINS_BEFORE_API_REFRESH = 2; + static int numTriggersSinceAPIRefresh = 0; if (!_publicSockAddr.isNull() && !_domainHandler.isConnected() - && _numNoReplyDomainCheckIns > NUM_NO_REPLY_CHECKINS_BEFORE_API_REFRESH && !_domainHandler.getPendingDomainID().isNull() - && !_domainHandler.wasConnectionRefused()) { + && !_domainHandler.wasConnectionRefused() + && ++numTriggersSinceAPIRefresh > 1) { // if we aren't connected to the domain-server, and we have an ID // (that we presume belongs to a domain in the HF Metaverse) - // we request connection information for the domain every so often to make sure what we have is up to date + // we re-request connection information from the AdressManager + // every 2 failing check in attempts to make sure what we have is up to date DependencyManager::get()->refreshPreviousLookup(); + numTriggersSinceAPIRefresh = 0; + } }