forked from lix-project/lix
add a nix.conf option to set a download speed limit
This commit is contained in:
parent
7aa36ae796
commit
0d2bf7acf9
|
@ -308,6 +308,9 @@ struct curlFileTransfer : public FileTransfer
|
||||||
|
|
||||||
curl_easy_setopt(req, CURLOPT_HTTPHEADER, requestHeaders);
|
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)
|
if (request.head)
|
||||||
curl_easy_setopt(req, CURLOPT_NOBODY, 1);
|
curl_easy_setopt(req, CURLOPT_NOBODY, 1);
|
||||||
|
|
||||||
|
|
|
@ -746,6 +746,13 @@ public:
|
||||||
/nix/store/xfghy8ixrhz3kyy6p724iv3cxji088dx-bash-4.4-p23`.
|
/nix/store/xfghy8ixrhz3kyy6p724iv3cxji088dx-bash-4.4-p23`.
|
||||||
)"};
|
)"};
|
||||||
|
|
||||||
|
Setting<unsigned int> downloadSpeed {
|
||||||
|
this, 0, "download-speed",
|
||||||
|
R"(
|
||||||
|
Specify the maxium transfer rate in kilobytes per second you want
|
||||||
|
nix to use for download.
|
||||||
|
)"};
|
||||||
|
|
||||||
Setting<std::string> netrcFile{
|
Setting<std::string> netrcFile{
|
||||||
this, fmt("%s/%s", nixConfDir, "netrc"), "netrc-file",
|
this, fmt("%s/%s", nixConfDir, "netrc"), "netrc-file",
|
||||||
R"(
|
R"(
|
||||||
|
|
Loading…
Reference in a new issue