From dee6c478632feeae5c845be82251117556ff1511 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 16 Jul 2009 00:08:52 +0200 Subject: [PATCH 1/1] Properly handle unlimited IRC reconnection retries Fixes #743. Also, do the first reconnect retry immediately after disconnect even with unlimited retries enabled. --- src/core/corenetwork.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index b1278ca9..81c92cbf 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -373,7 +373,7 @@ void CoreNetwork::socketDisconnected() { Core::setNetworkConnected(userId(), networkId(), false); } else if(_autoReconnectCount != 0) { setConnectionState(Network::Reconnecting); - if(_autoReconnectCount == autoReconnectRetries()) + if(_autoReconnectCount == -1 || _autoReconnectCount == autoReconnectRetries()) doAutoReconnect(); // first try is immediate else _autoReconnectTimer.start(); @@ -409,7 +409,7 @@ void CoreNetwork::networkInitialized() { if(useAutoReconnect()) { // reset counter - _autoReconnectCount = autoReconnectRetries(); + _autoReconnectCount = unlimitedReconnectRetries() ? -1 : autoReconnectRetries(); } // restore away state @@ -520,8 +520,8 @@ void CoreNetwork::doAutoReconnect() { qWarning() << "CoreNetwork::doAutoReconnect(): Cannot reconnect while not being disconnected!"; return; } - if(_autoReconnectCount > 0) - _autoReconnectCount--; + if(_autoReconnectCount > 0 || _autoReconnectCount == -1) + _autoReconnectCount--; // -2 means we delay the next reconnect connectToIrc(true); } -- 2.20.1