diff --git a/interface/src/ConnectionMonitor.cpp b/interface/src/ConnectionMonitor.cpp index 8f0c12634c..ca90d039f4 100644 --- a/interface/src/ConnectionMonitor.cpp +++ b/interface/src/ConnectionMonitor.cpp @@ -18,7 +18,6 @@ #include #include #include -#include // Because the connection monitor is created at startup, the time we wait on initial load // should be longer to allow the application to initialize. @@ -40,8 +39,7 @@ void ConnectionMonitor::init() { _timer.setSingleShot(true); if (!domainHandler.isConnected()) { - Setting::Handle enableInterstitialMode{ "enableInterstitialMode", false }; - if (enableInterstitialMode.get()) { + if (_enableInterstitialMode.get()) { _timer.start(ON_INITIAL_LOAD_REDIRECT_AFTER_DISCONNECTED_FOR_X_MS); } else { _timer.start(ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); @@ -50,8 +48,7 @@ void ConnectionMonitor::init() { connect(&_timer, &QTimer::timeout, this, [this]() { // set in a timeout error - Setting::Handle enableInterstitialMode{ "enableInterstitialMode", false }; - if (enableInterstitialMode.get()) { + if (_enableInterstitialMode.get()) { qDebug() << "ConnectionMonitor: Redirecting to 404 error domain"; emit setRedirectErrorState(REDIRECT_HIFI_ADDRESS, 5); } else { @@ -62,8 +59,7 @@ void ConnectionMonitor::init() { } void ConnectionMonitor::startTimer() { - Setting::Handle enableInterstitialMode{ "enableInterstitialMode", false }; - if (enableInterstitialMode.get()) { + if (_enableInterstitialMode.get()) { _timer.start(REDIRECT_AFTER_DISCONNECTED_FOR_X_MS); } else { _timer.start(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS); @@ -72,8 +68,7 @@ void ConnectionMonitor::startTimer() { void ConnectionMonitor::stopTimer() { _timer.stop(); - Setting::Handle enableInterstitialMode{ "enableInterstitialMode", false }; - if (!enableInterstitialMode.get()) { + if (!_enableInterstitialMode.get()) { DependencyManager::get()->setDomainConnectionFailureVisibility(false); } } diff --git a/interface/src/ConnectionMonitor.h b/interface/src/ConnectionMonitor.h index 5e75e2618b..f0589a3b8c 100644 --- a/interface/src/ConnectionMonitor.h +++ b/interface/src/ConnectionMonitor.h @@ -15,6 +15,8 @@ #include #include +#include + class QUrl; class QString; @@ -32,6 +34,7 @@ private slots: private: QTimer _timer; + Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", false }; }; -#endif // hifi_ConnectionMonitor_h \ No newline at end of file +#endif // hifi_ConnectionMonitor_h diff --git a/libraries/networking/src/DomainHandler.cpp b/libraries/networking/src/DomainHandler.cpp index d2d576d8b7..b2f118c5c8 100644 --- a/libraries/networking/src/DomainHandler.cpp +++ b/libraries/networking/src/DomainHandler.cpp @@ -14,7 +14,6 @@ #include #include -#include #include #include @@ -486,9 +485,8 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer enableInterstitialMode{ "enableInterstitialMode", false }; - if (enableInterstitialMode.get()) { + if (_enableInterstitialMode.get()) { if (reasonCode == ConnectionRefusedReason::ProtocolMismatch || reasonCode == ConnectionRefusedReason::NotAuthorized) { // ingest the error - this is a "hard" connection refusal. setRedirectErrorState(_errorDomainURL, (int)reasonCode); @@ -496,8 +494,7 @@ void DomainHandler::processDomainServerConnectionDeniedPacket(QSharedPointer #include +#include + #include "HifiSockAddr.h" #include "NetworkPeer.h" #include "NLPacket.h" @@ -221,6 +223,7 @@ private: NetworkPeer _icePeer; bool _isConnected { false }; bool _isInErrorState { false }; + Setting::Handle _enableInterstitialMode{ "enableInterstitialMode", false }; QJsonObject _settingsObject; QString _pendingPath; QTimer _settingsTimer;