Fix the reconnection backoff accidentally resetting when thrown out of certain IRC servers (#3328)

This commit is contained in:
pajlada
2021-10-31 15:44:38 +01:00
committed by GitHub
parent d7337ff69f
commit 4b903d7fcf
3 changed files with 8 additions and 4 deletions
+1
View File
@@ -44,6 +44,7 @@
- Bugfix: Fixed being unable to disable `First Message` highlights (#3293)
- Bugfix: Fixed `First Message` custom sound not persisting through restart. (#3303)
- Bugfix: Fixed `First Message` scrollbar highlights not being disabled. (#3325)
- Bugfix: Fixed the reconnection backoff accidentally resetting when thrown out of certain IRC servers. (#3328)
- Bugfix: Fixed underlying text from disabled emotes not being colorized properly. (#3333)
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
+5 -2
View File
@@ -108,9 +108,12 @@ IrcConnection::IrcConnection(QObject *parent)
QObject::connect(this, &Communi::IrcConnection::messageReceived,
[this](Communi::IrcMessage *message) {
// This connection is probably still alive
this->recentlyReceivedMessage_ = true;
this->reconnectBackoff_.reset();
if (message->command() == "372") // MOTD
{
this->reconnectBackoff_.reset();
}
});
}
+2 -2
View File
@@ -30,8 +30,8 @@ private:
QTimer reconnectTimer_;
std::atomic<bool> recentlyReceivedMessage_{true};
// Reconnect with a base delay of 1 second and max out at 1 second * (2^4) (i.e. 16 seconds)
ExponentialBackoff<4> reconnectBackoff_{std::chrono::milliseconds{1000}};
// Reconnect with a base delay of 1 second and max out at 1 second * (2^(5-1)) (i.e. 16 seconds)
ExponentialBackoff<5> reconnectBackoff_{std::chrono::milliseconds{1000}};
std::atomic<bool> expectConnectionLoss_{false};