diff --git a/addons/pvr.tvh/src/HTSPConnection.cpp b/addons/pvr.tvh/src/HTSPConnection.cpp index e6cc1eba6..587e36910 100644 --- a/addons/pvr.tvh/src/HTSPConnection.cpp +++ b/addons/pvr.tvh/src/HTSPConnection.cpp @@ -497,7 +497,7 @@ void CHTSPConnection::Register ( void ) void* CHTSPConnection::Process ( void ) { static bool log = false; - static unsigned int retryAttempt = 1; + static unsigned int retryAttempt = 0; while (!IsStopped()) { @@ -539,21 +539,16 @@ void* CHTSPConnection::Process ( void ) XBMC->QueueNotification(QUEUE_ERROR, "Unable to connect to %s:%d", host.c_str(), port); // Retry a few times with a short interval, after that with the default timeout - int retryTimeout; - - if (retryAttempt <= FAST_RECONNECT_TRIES) - retryTimeout = FAST_RECONNECT_INTERVAL; + if (++retryAttempt <= FAST_RECONNECT_ATTEMPTS) + Sleep(FAST_RECONNECT_INTERVAL); else - retryTimeout = timeout; - - Sleep(retryTimeout); - ++retryAttempt; + Sleep(timeout); continue; } tvhdebug("connected"); log = false; - retryAttempt = 1; + retryAttempt = 0; /* Start connect thread */ m_regThread.CreateThread(true); diff --git a/addons/pvr.tvh/src/Tvheadend.h b/addons/pvr.tvh/src/Tvheadend.h index 8db01555f..c6fcc4909 100644 --- a/addons/pvr.tvh/src/Tvheadend.h +++ b/addons/pvr.tvh/src/Tvheadend.h @@ -53,7 +53,7 @@ extern "C" { * Configuration defines */ #define HTSP_API_VERSION 12 -#define FAST_RECONNECT_TRIES 5 +#define FAST_RECONNECT_ATTEMPTS 5 #define FAST_RECONNECT_INTERVAL 500 // ms /*