don't thrash API re-check when connection denied

This commit is contained in:
Stephen Birarda 2016-06-06 11:49:01 -07:00
parent 8318e9ccc8
commit f59335ceff
3 changed files with 12 additions and 6 deletions

View file

@ -85,6 +85,7 @@ void DomainHandler::softReset() {
clearSettings();
_domainConnectionRefusals.clear();
_connectionDenialsSinceKeypairRegen = 0;
// cancel the failure timeout for any pending requests for settings
@ -141,9 +142,6 @@ void DomainHandler::setSocketAndID(const QString& hostname, quint16 port, const
// set the new hostname
_hostname = hostname;
// FIXME - is this the right place???
_domainConnectionRefusals.clear();
qCDebug(networking) << "Updated domain hostname to" << _hostname;
// re-set the sock addr to null and fire off a lookup of the IP address for this domain-server's hostname
@ -168,7 +166,7 @@ void DomainHandler::setSocketAndID(const QString& hostname, quint16 port, const
}
void DomainHandler::setIceServerHostnameAndID(const QString& iceServerHostname, const QUuid& id) {
if (id != _uuid) {
if (_iceServerSockAddr.getAddress().toString() != iceServerHostname && id != _pendingDomainID) {
// re-set the domain info to connect to new domain
hardReset();

View file

@ -72,10 +72,11 @@ public:
bool isConnected() const { return _isConnected; }
void setIsConnected(bool isConnected);
bool wasConnectionRefused() const { return !_domainConnectionRefusals.isEmpty(); }
bool hasSettings() const { return !_settingsObject.isEmpty(); }
void requestDomainSettings();
const QJsonObject& getSettingsObject() const { return _settingsObject; }
void setPendingPath(const QString& pendingPath) { _pendingPath = pendingPath; }
const QString& getPendingPath() { return _pendingPath; }

View file

@ -356,7 +356,14 @@ void NodeList::sendDomainServerCheckIn() {
_numNoReplyDomainCheckIns++;
}
if (!_publicSockAddr.isNull() && !_domainHandler.isConnected() && !_domainHandler.getPendingDomainID().isNull()) {
const int NUM_NO_REPLY_CHECKINS_BEFORE_API_REFRESH = 2;
if (!_publicSockAddr.isNull()
&& !_domainHandler.isConnected()
&& _numNoReplyDomainCheckIns > NUM_NO_REPLY_CHECKINS_BEFORE_API_REFRESH
&& !_domainHandler.getPendingDomainID().isNull()
&& !_domainHandler.wasConnectionRefused()) {
// 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