diff options
author | Rémy Raes <contact@remyraes.com> | 2024-01-21 00:56:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-21 00:56:33 +0100 |
commit | bf7b5e0a81f84d712c393980ad9486624c1ea58e (patch) | |
tree | 4ded034d4ee658758187dd5c146281d4cebdda3f /primedev/mods | |
parent | c7edf9bf74f7b1e7a53db5365ebf73fcb8a06509 (diff) | |
download | NorthstarLauncher-bf7b5e0a81f84d712c393980ad9486624c1ea58e.tar.gz NorthstarLauncher-bf7b5e0a81f84d712c393980ad9486624c1ea58e.zip |
Add slow-speed timeout when downloading mod (#611)v1.22.1-rc4v1.22.1-rc3v1.22.1
Abort request if network connection is dropped or too slow.
Diffstat (limited to 'primedev/mods')
-rw-r--r-- | primedev/mods/autodownload/moddownloader.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/primedev/mods/autodownload/moddownloader.cpp b/primedev/mods/autodownload/moddownloader.cpp index 80be8d19..1e3c6af6 100644 --- a/primedev/mods/autodownload/moddownloader.cpp +++ b/primedev/mods/autodownload/moddownloader.cpp @@ -163,6 +163,11 @@ std::optional<fs::path> ModDownloader::FetchModFromDistantStore(std::string_view curl_easy_setopt(easyhandle, CURLOPT_URL, url.data()); curl_easy_setopt(easyhandle, CURLOPT_FAILONERROR, 1L); + + // abort if slower than 30 bytes/sec during 10 seconds + curl_easy_setopt(easyhandle, CURLOPT_LOW_SPEED_TIME, 10L); + curl_easy_setopt(easyhandle, CURLOPT_LOW_SPEED_LIMIT, 30L); + curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, fp); curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, WriteData); curl_easy_setopt(easyhandle, CURLOPT_NOPROGRESS, 0L); |