require two triggers for API refresh, fix check for ICE domain

This commit is contained in:
Stephen Birarda 2016-06-07 11:10:48 -07:00
parent f59335ceff
commit e39c708bf6
2 changed files with 9 additions and 5 deletions

View file

@ -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();

View file

@ -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<AddressManager>()->refreshPreviousLookup();
numTriggersSinceAPIRefresh = 0;
}
}