mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
change to CURLOPT_CONNECTTIMEOUT_MS and ...
use a connect_timeout of 300ms for remote timer
This commit is contained in:
@@ -280,7 +280,7 @@ CTimerList::CTimerList()
|
|||||||
Timer = new CTimerdClient();
|
Timer = new CTimerdClient();
|
||||||
timerNew_message = "";
|
timerNew_message = "";
|
||||||
timerNew_pluginName = "";
|
timerNew_pluginName = "";
|
||||||
httpConnectTimeout = 3;
|
httpConnectTimeout = 300; // ms
|
||||||
changed = false;
|
changed = false;
|
||||||
|
|
||||||
/* most probable default */
|
/* most probable default */
|
||||||
|
@@ -66,7 +66,7 @@ int CHTTPTool::show_progress( void *clientp, double dltotal, double dlnow, doubl
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
bool CHTTPTool::downloadFile(const std::string & URL, const char * const downloadTarget, int globalProgressEnd, int connecttimeout/*=10*/, int timeout/*=1800*/)
|
bool CHTTPTool::downloadFile(const std::string & URL, const char * const downloadTarget, int globalProgressEnd, int connecttimeout/*=10000*/, int timeout/*=1800*/)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
@@ -98,7 +98,7 @@ printf("url is %s\n", URL.c_str());
|
|||||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str());
|
curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
|
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
|
||||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
|
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
|
||||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, connecttimeout);
|
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, connecttimeout);
|
||||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
|
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||||
@@ -136,7 +136,7 @@ printf("download code %d\n", res);
|
|||||||
return res==CURLE_OK;
|
return res==CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CHTTPTool::downloadString(const std::string & URL, int globalProgressEnd, int connecttimeout/*=10*/, int timeout/*=1800*/)
|
std::string CHTTPTool::downloadString(const std::string & URL, int globalProgressEnd, int connecttimeout/*=10000*/, int timeout/*=1800*/)
|
||||||
{
|
{
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
@@ -162,7 +162,7 @@ printf("url is %s\n", URL.c_str());
|
|||||||
curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str());
|
curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str());
|
||||||
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
|
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1);
|
||||||
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
|
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout);
|
||||||
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, connecttimeout);
|
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, connecttimeout);
|
||||||
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
|
curl_easy_setopt(curl, CURLOPT_FAILONERROR, true);
|
||||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
|
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@@ -52,8 +52,8 @@ class CHTTPTool
|
|||||||
CHTTPTool();
|
CHTTPTool();
|
||||||
void setStatusViewer( CProgressWindow* statusview );
|
void setStatusViewer( CProgressWindow* statusview );
|
||||||
|
|
||||||
bool downloadFile( const std::string & URL, const char * const downloadTarget, int globalProgressEnd=-1, int connecttimeout=10, int timeout=1800);
|
bool downloadFile( const std::string & URL, const char * const downloadTarget, int globalProgressEnd=-1, int connecttimeout=10000, int timeout=1800);
|
||||||
std::string downloadString(const std::string & URL, int globalProgressEnd=-1, int connecttimeout=10, int timeout=1800);
|
std::string downloadString(const std::string & URL, int globalProgressEnd=-1, int connecttimeout=10000, int timeout=1800);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user