From 14f5f534e3e6dc22eade3ea63a111a4c218ef18d Mon Sep 17 00:00:00 2001 From: APTX Date: Sun, 13 Feb 2011 14:46:00 +0100 Subject: [PATCH] Add a ConnectionTimedOutError if too many commands time out without a reply. --- anidbudpclient_global.h | 1 + client.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/anidbudpclient_global.h b/anidbudpclient_global.h index 1a1446e..7b04f03 100644 --- a/anidbudpclient_global.h +++ b/anidbudpclient_global.h @@ -29,6 +29,7 @@ namespace AniDBUdpClient ClientBannedError, ClientVersionOutdatedError, ServerError, + ConnectionTimedOutError, UnknownError, }; diff --git a/client.cpp b/client.cpp index bd9bcec..e9e6473 100644 --- a/client.cpp +++ b/client.cpp @@ -648,6 +648,14 @@ void Client::enterRecieveFailState() #ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG qDebug() << "Entering RecieveFail State"; #endif + if (commandsTimedOut < 3) + return; + + disconnect(); + m_error = ConnectionTimedOutError; + m_errorString = tr("Connection Timed Out"); + emit connectionError(); + } // ------------------------------------------------------------------------------------- -- 2.52.0