Skip to content

Commit

Permalink
fix: abort request if network connection is dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
Alystrasz committed Dec 2, 2023
1 parent c656859 commit fb8ebf6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NorthstarDLL/mods/autodownload/moddownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ void FetchModSync(std::promise<std::optional<fs::path>>&& p, std::string_view ur

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);
result = curl_easy_perform(easyhandle);
Expand Down

0 comments on commit fb8ebf6

Please sign in to comment.