diff options
author | Solene Rapenne <solene@perso.pw> | 2022-08-19 12:40:22 +0200 |
---|---|---|
committer | Solene Rapenne <solene@perso.pw> | 2022-08-19 12:40:22 +0200 |
commit | 0d2bf7acf994ba331d6f72c746721b354931be76 (patch) | |
tree | faa4739dde482c9d14c5cb1e700898e56b76c5cc /src/libstore/filetransfer.cc | |
parent | 7aa36ae79673d89e120a97a3c6fd9fbb46ea9da1 (diff) |
add a nix.conf option to set a download speed limit
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r-- | src/libstore/filetransfer.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc index 8454ad7d2..252403cb5 100644 --- a/src/libstore/filetransfer.cc +++ b/src/libstore/filetransfer.cc @@ -308,6 +308,9 @@ struct curlFileTransfer : public FileTransfer curl_easy_setopt(req, CURLOPT_HTTPHEADER, requestHeaders); + if (settings.downloadSpeed.get() > 0) + curl_easy_setopt(req, CURLOPT_MAX_RECV_SPEED_LARGE, (curl_off_t) (settings.downloadSpeed.get() * 1024)); + if (request.head) curl_easy_setopt(req, CURLOPT_NOBODY, 1); |