From 63359e4c24f1929ffbea5c18de9f7923d4aae3e6 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Tue, 24 Feb 2015 20:28:32 +0200 Subject: [PATCH] Fixed CURL timeout and added a stale connection detection (Thanks to Daniel Ribeiro). --- HISTORY | 4 ++++ iptv.c | 2 +- protocolcurl.c | 3 ++- protocolcurl.h | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/HISTORY b/HISTORY index 13afb37..c769733 100644 --- a/HISTORY +++ b/HISTORY @@ -264,3 +264,7 @@ VDR Plugin 'iptv' Revision History - Updated for vdr-2.2.0. - Updated German translations (Thanks to Frank Neumann). - Updated Lithuanian translations (Thanks to Valdemaras Pipiras). + +2015-XX-XX: Version 2.2.1 + +- Fixed CURL timeout and added a stale connection detection (Thanks to Daniel Ribeiro). diff --git a/iptv.c b/iptv.c index 1c6981f..595c1f4 100644 --- a/iptv.c +++ b/iptv.c @@ -21,7 +21,7 @@ #define GITVERSION "" #endif - const char VERSION[] = "2.2.0" GITVERSION; + const char VERSION[] = "2.2.1" GITVERSION; static const char DESCRIPTION[] = trNOOP("Experience the IPTV"); class cPluginIptv : public cPlugin { diff --git a/protocolcurl.c b/protocolcurl.c index fc42429..3183b25 100644 --- a/protocolcurl.c +++ b/protocolcurl.c @@ -277,8 +277,9 @@ bool cIptvProtocolCurl::Connect() iptv_curl_easy_setopt(handleM, CURLOPT_NETRC_FILE, *netrc); // Set timeouts - iptv_curl_easy_setopt(handleM, CURLOPT_TIMEOUT, (long)eConnectTimeoutS); iptv_curl_easy_setopt(handleM, CURLOPT_CONNECTTIMEOUT, (long)eConnectTimeoutS); + iptv_curl_easy_setopt(handleM, CURLOPT_LOW_SPEED_LIMIT, (long)eLowSpeedLimitBytes); + iptv_curl_easy_setopt(handleM, CURLOPT_LOW_SPEED_TIME, (long)eLowSpeedTimeoutS); // Set user-agent iptv_curl_easy_setopt(handleM, CURLOPT_USERAGENT, *cString::sprintf("vdr-%s/%s", PLUGIN_NAME_I18N, VERSION)); diff --git a/protocolcurl.h b/protocolcurl.h index a5a0cc4..fb6e66b 100644 --- a/protocolcurl.h +++ b/protocolcurl.h @@ -30,6 +30,8 @@ private: }; enum { eConnectTimeoutS = 5, // in seconds + eLowSpeedTimeoutS = 3, // in seconds + eLowSpeedLimitBytes = 100, // in bytes per second eMaxDownloadSpeedMBits = 20, // in megabits per second eKeepAliveIntervalMs = 300000 // in milliseconds };