From cb53823eeecff3f033adfe2cb1a48d8b8a89dbae Mon Sep 17 00:00:00 2001 From: genius3000 Date: Thu, 13 Apr 2017 18:01:36 -0600 Subject: [PATCH] core: connectToIrc: Pick first IRC server specified when not failed When connecting to the IRC network, only clear the '_previousConnectionAttemptFailed' flag when trying the next server in the list. Otherwise, reset server index to start from the top. Currently, Quassel will continue to use the last used (working) server (or a random server if set to). This doesn't match the intention of having an ordered list of servers to use. The change here just makes Quassel start with the first server in the list unless it's a failed attempt, in which it continues down the list (same as currently). This fixes the issue of getting "stuck" on a specific server even if you manually disconnect and connect. Reference: http://bugs.quassel-irc.org/issues/693 And: http://bugs.quassel-irc.org/issues/1006 Fixes #693 and #1006 Resolves GH-287 --- src/core/corenetwork.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 4d1fc015..3ad9d7cb 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -214,12 +214,16 @@ void CoreNetwork::connectToIrc(bool reconnecting) } else if (_previousConnectionAttemptFailed) { // cycle to next server if previous connection attempt failed + _previousConnectionAttemptFailed = false; displayMsg(Message::Server, BufferInfo::StatusBuffer, "", tr("Connection failed. Cycling to next Server")); if (++_lastUsedServerIndex >= serverList().size()) { _lastUsedServerIndex = 0; } } - _previousConnectionAttemptFailed = false; + else { + // Start out with the top server in the list + _lastUsedServerIndex = 0; + } Server server = usedServer(); displayStatusMsg(tr("Connecting to %1:%2...").arg(server.host).arg(server.port)); -- 2.20.1