adding changes for overriding host change for error state

This commit is contained in:
Wayne Chen 2018-09-12 18:31:01 -07:00
parent 3fe3f674d0
commit ad233677b8
3 changed files with 11 additions and 4 deletions

View file

@ -269,6 +269,7 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
// save the last visited domain URL.
_lastVisitedURL = lookupUrl;
auto lastVisitedURLStr = lookupUrl.toString().toStdString();
// a network address lookup clears the previous lookup since we don't expect to re-attempt it
_previousAPILookup.clear();
@ -816,8 +817,10 @@ bool AddressManager::setDomainInfo(const QUrl& domainURL, LookupTrigger trigger)
const QString hostname = domainURL.host();
quint16 port = domainURL.port();
bool emitHostChanged { false };
// Check if domain handler is in error state. always emit host changed if true.
bool isInErrorState = DependencyManager::get<NodeList>()->getDomainHandler().isInErrorState();
if (domainURL != _domainURL) {
if (domainURL != _domainURL || isInErrorState) {
addCurrentAddressToHistory(trigger);
emitHostChanged = true;
}

View file

@ -56,7 +56,7 @@ DomainHandler::DomainHandler(QObject* parent) :
// stop the refresh timer if we connect to a domain
connect(this, &DomainHandler::connectedToDomain, &_apiRefreshTimer, &QTimer::stop);
// stop the refresh timer if we connect to a domain
// stop the refresh timer if redirected to the error domain
connect(this, &DomainHandler::redirectToErrorDomainURL, &_apiRefreshTimer, &QTimer::stop);
}
@ -109,14 +109,16 @@ void DomainHandler::softReset() {
QMetaObject::invokeMethod(&_settingsTimer, "stop");
// restart the API refresh timer in case we fail to connect and need to refresh information
if (!_isInErrorState)
if (!_isInErrorState) {
QMetaObject::invokeMethod(&_apiRefreshTimer, "start");
}
_isInErrorState = false;
}
void DomainHandler::hardReset() {
if (!_isInErrorState)
if (!_isInErrorState) {
emit resetting();
}
softReset();

View file

@ -173,6 +173,8 @@ public slots:
// sets domain handler in error state.
void setRedirectErrorState(QUrl errorUrl, int reasonCode);
bool isInErrorState() { return _isInErrorState; }
private slots:
void completedHostnameLookup(const QHostInfo& hostInfo);
void completedIceServerHostnameLookup();