Changed: Use lower connection timeout for css/img/data downloads

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-04-30 22:52:38 +03:00
parent 2e84381bfa
commit 4fcd71d7ba
2 changed files with 5 additions and 1 deletions

View file

@ -746,7 +746,7 @@ namespace NLGUI
{
public:
CDataDownload(const std::string &u, const std::string &d, TDataType t, CViewBase *i, const std::string &s, const std::string &m, const CStyleParams &style = CStyleParams(), const TImageType imagetype = NormalImage)
: data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0)
: data(NULL), fp(NULL), url(u), dest(d), type(t), luaScript(s), md5sum(m), redirects(0), ConnectionTimeout(60)
{
if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype));
}
@ -762,6 +762,7 @@ namespace NLGUI
uint32 redirects;
FILE *fp;
std::vector<CDataImageDownload> imgs;
uint32 ConnectionTimeout;
};
std::list<CDataDownload> Curls;

View file

@ -546,6 +546,9 @@ namespace NLGUI
download.data = new CCurlWWWData(curl, download.url);
download.fp = fp;
// initial connection timeout, curl default is 300sec
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, download.ConnectionTimeout);
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, true);
curl_easy_setopt(curl, CURLOPT_URL, download.url.c_str());