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

--HG--
branch : develop
feature/clean-deprecated
Nimetu 6 years ago
parent 2e84381bfa
commit 4fcd71d7ba

@ -746,7 +746,7 @@ namespace NLGUI
{ {
public: 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) 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)); if (t == ImgType) imgs.push_back(CDataImageDownload(i, style, imagetype));
} }
@ -762,6 +762,7 @@ namespace NLGUI
uint32 redirects; uint32 redirects;
FILE *fp; FILE *fp;
std::vector<CDataImageDownload> imgs; std::vector<CDataImageDownload> imgs;
uint32 ConnectionTimeout;
}; };
std::list<CDataDownload> Curls; std::list<CDataDownload> Curls;

@ -546,6 +546,9 @@ namespace NLGUI
download.data = new CCurlWWWData(curl, download.url); download.data = new CCurlWWWData(curl, download.url);
download.fp = fp; 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_NOPROGRESS, true);
curl_easy_setopt(curl, CURLOPT_URL, download.url.c_str()); curl_easy_setopt(curl, CURLOPT_URL, download.url.c_str());

Loading…
Cancel
Save