mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Add options to set low speed timeout values for libcurl
This commit is contained in:
parent
8cb0b99008
commit
90dcaf0106
@ -190,6 +190,8 @@ struct CurlConfig
|
|||||||
std::string sUserAgent;
|
std::string sUserAgent;
|
||||||
long int iTimeout;
|
long int iTimeout;
|
||||||
curl_off_t iDownloadRate;
|
curl_off_t iDownloadRate;
|
||||||
|
long int iLowSpeedTimeout;
|
||||||
|
long int iLowSpeedTimeoutRate;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GogAPIConfig
|
struct GogAPIConfig
|
||||||
|
2
main.cpp
2
main.cpp
@ -219,6 +219,8 @@ int main(int argc, char *argv[])
|
|||||||
("threads", bpo::value<unsigned int>(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads")
|
("threads", bpo::value<unsigned int>(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads")
|
||||||
("dlc-list", bpo::value<std::string>(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC")
|
("dlc-list", bpo::value<std::string>(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC")
|
||||||
("progress-interval", bpo::value<int>(&Globals::globalConfig.iProgressInterval)->default_value(100), "Set interval for progress bar update (milliseconds)\nValue must be between 1 and 10000")
|
("progress-interval", bpo::value<int>(&Globals::globalConfig.iProgressInterval)->default_value(100), "Set interval for progress bar update (milliseconds)\nValue must be between 1 and 10000")
|
||||||
|
("lowspeed-timeout", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted")
|
||||||
|
("lowspeed-rate", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeoutRate)->default_value(200), "Set average transfer speed in bytes per second that the transfer should be below during time specified with --lowspeed-timeout for it to be considered too slow and aborted")
|
||||||
;
|
;
|
||||||
// Options read from config file
|
// Options read from config file
|
||||||
options_cfg_only.add_options()
|
options_cfg_only.add_options()
|
||||||
|
@ -96,8 +96,8 @@ Downloader::Downloader()
|
|||||||
curl_easy_setopt(curlhandle, CURLOPT_XFERINFODATA, this);
|
curl_easy_setopt(curlhandle, CURLOPT_XFERINFODATA, this);
|
||||||
|
|
||||||
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_TIME, 30);
|
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_TIME, Globals::globalConfig.curlConf.iLowSpeedTimeout);
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_LIMIT, 200);
|
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_LIMIT, Globals::globalConfig.curlConf.iLowSpeedTimeoutRate);
|
||||||
|
|
||||||
if (!Globals::globalConfig.curlConf.sCACertPath.empty())
|
if (!Globals::globalConfig.curlConf.sCACertPath.empty())
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_CAINFO, Globals::globalConfig.curlConf.sCACertPath.c_str());
|
curl_easy_setopt(curlhandle, CURLOPT_CAINFO, Globals::globalConfig.curlConf.sCACertPath.c_str());
|
||||||
@ -2656,8 +2656,8 @@ void Downloader::processDownloadQueue(Config conf, const unsigned int& tid)
|
|||||||
curl_easy_setopt(dlhandle, CURLOPT_FILETIME, 1L);
|
curl_easy_setopt(dlhandle, CURLOPT_FILETIME, 1L);
|
||||||
|
|
||||||
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
||||||
curl_easy_setopt(dlhandle, CURLOPT_LOW_SPEED_TIME, 30);
|
curl_easy_setopt(dlhandle, CURLOPT_LOW_SPEED_TIME, conf.curlConf.iLowSpeedTimeout);
|
||||||
curl_easy_setopt(dlhandle, CURLOPT_LOW_SPEED_LIMIT, 200);
|
curl_easy_setopt(dlhandle, CURLOPT_LOW_SPEED_LIMIT, conf.curlConf.iLowSpeedTimeoutRate);
|
||||||
|
|
||||||
if (!conf.curlConf.sCACertPath.empty())
|
if (!conf.curlConf.sCACertPath.empty())
|
||||||
curl_easy_setopt(dlhandle, CURLOPT_CAINFO, conf.curlConf.sCACertPath.c_str());
|
curl_easy_setopt(dlhandle, CURLOPT_CAINFO, conf.curlConf.sCACertPath.c_str());
|
||||||
|
@ -39,8 +39,8 @@ galaxyAPI::galaxyAPI(CurlConfig& conf)
|
|||||||
curl_easy_setopt(curlhandle, CURLOPT_MAX_RECV_SPEED_LARGE, curlConf.iDownloadRate);
|
curl_easy_setopt(curlhandle, CURLOPT_MAX_RECV_SPEED_LARGE, curlConf.iDownloadRate);
|
||||||
|
|
||||||
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
// Assume that we have connection error and abort transfer with CURLE_OPERATION_TIMEDOUT if download speed is less than 200 B/s for 30 seconds
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_TIME, 30);
|
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_TIME, curlConf.iLowSpeedTimeout);
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_LIMIT, 200);
|
curl_easy_setopt(curlhandle, CURLOPT_LOW_SPEED_LIMIT, curlConf.iLowSpeedTimeoutRate);
|
||||||
|
|
||||||
if (!curlConf.sCACertPath.empty())
|
if (!curlConf.sCACertPath.empty())
|
||||||
curl_easy_setopt(curlhandle, CURLOPT_CAINFO, curlConf.sCACertPath.c_str());
|
curl_easy_setopt(curlhandle, CURLOPT_CAINFO, curlConf.sCACertPath.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user