aboutsummaryrefslogtreecommitdiff
path: root/primedev/mods
diff options
context:
space:
mode:
authorRémy Raes <contact@remyraes.com>2024-01-21 00:56:33 +0100
committerGitHub <noreply@github.com>2024-01-21 00:56:33 +0100
commitbf7b5e0a81f84d712c393980ad9486624c1ea58e (patch)
tree4ded034d4ee658758187dd5c146281d4cebdda3f /primedev/mods
parentc7edf9bf74f7b1e7a53db5365ebf73fcb8a06509 (diff)
downloadNorthstarLauncher-1.22.1-rc3.tar.gz
NorthstarLauncher-1.22.1-rc3.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.cpp5
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);