History

Update ConnectionMonitor to increase timeout on startup

Ryan Huffman committed 10 years ago

Commit 84bcefc1 parent 32b5c841 file · +9 −3Browse files

Showing the changes to interface/src/ConnectionMonitor.cpp (1 of 1 file). Show all

Unified · Split

interface/src/ConnectionMonitor.cpp+9−3
@@ -18,6 +18,9 @@ · 17 unmodified lines
1818 #include <DomainHandler.h>
1919 #include <AddressManager.h>
2020
21+// Because the connection monitor is created at startup, the time we wait on initial load
22+// should be longer to allow the application to initialize.
23+static const int ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 10000;
2124 static const int DISPLAY_AFTER_DISCONNECTED_FOR_X_MS = 5000;
2225
2326 void ConnectionMonitor::init() {
@@ -28,7 +31,7 @@ void ConnectionMonitor::init() { · 4 unmodified lines
2831 connect(&domainHandler, &DomainHandler::connectedToDomain, this, &ConnectionMonitor::connectedToDomain);
2932
3033 _timer.setSingleShot(true);
31− _timer.setInterval(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS);
34+ _timer.setInterval(ON_INITIAL_LOAD_DISPLAY_AFTER_DISCONNECTED_FOR_X_MS);
3235 if (!domainHandler.isConnected()) {
3336 _timer.start();
3437 }
@@ -37,10 +40,13 @@ void ConnectionMonitor::init() { · 2 unmodified lines
3740 connect(&_timer, &QTimer::timeout, dialogsManager.data(), &DialogsManager::indicateDomainConnectionFailure);
3841 }
3942
40−void ConnectionMonitor::disconnectedFromDomain() {
43+void ConnectionMonitor::startTimer() {
44+ qDebug() << "ConnectionMonitor: Starting timer";
45+ _timer.setInterval(DISPLAY_AFTER_DISCONNECTED_FOR_X_MS);
4146 _timer.start();
4247 }
4348
44−void ConnectionMonitor::connectedToDomain(const QString& name) {
49+void ConnectionMonitor::stopTimer() {
50+ qDebug() << "ConnectionMonitor: Stopping timer";
4551 _timer.stop();
4652 }