check for hard refusal to 404

This commit is contained in:
Wayne Chen 2018-10-01 10:06:13 -07:00
parent eab57633a5
commit 5f05be554f
2 changed files with 8 additions and 1 deletions

View file

@ -139,6 +139,11 @@ void DomainHandler::hardReset() {
_pendingPath.clear();
}
bool DomainHandler::isHardRefusal(int reasonCode) {
return (reasonCode == (int)ConnectionRefusedReason::ProtocolMismatch || reasonCode == (int)ConnectionRefusedReason::NotAuthorized ||
reasonCode == (int)ConnectionRefusedReason::TimedOut);
}
bool DomainHandler::getInterstitialModeEnabled() const {
return _interstitialModeSettingLock.resultWithReadLock<bool>([&] {
return _enableInterstitialMode.get();
@ -360,7 +365,7 @@ void DomainHandler::loadedErrorDomain(std::map<QString, QString> namedPaths) {
void DomainHandler::setRedirectErrorState(QUrl errorUrl, QString reasonMessage, int reasonCode, const QString& extraInfo) {
_lastDomainConnectionError = reasonCode;
if (getInterstitialModeEnabled()) {
if (getInterstitialModeEnabled() && isHardRefusal(reasonCode)) {
_errorDomainURL = errorUrl;
_isInErrorState = true;
qCDebug(networking) << "Error connecting to domain: " << reasonMessage;

View file

@ -212,6 +212,8 @@ private:
void sendDisconnectPacket();
void hardReset();
bool isHardRefusal(int reasonCode);
QUuid _uuid;
Node::LocalID _localID;
QUrl _domainURL;