From: APTX Date: Sun, 13 Feb 2011 13:46:00 +0000 (+0100) Subject: Add a ConnectionTimedOutError if too many commands time out without a reply. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=14f5f534e3e6dc22eade3ea63a111a4c218ef18d;p=anidbudpclient.git Add a ConnectionTimedOutError if too many commands time out without a reply. --- 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(); + } // -------------------------------------------------------------------------------------