mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
DownloadSettings -> DataTransferSettings
This commit is contained in:
parent
741e9012d3
commit
e5cc53beec
3 changed files with 14 additions and 14 deletions
|
@ -27,9 +27,9 @@ using namespace std::string_literals;
|
|||
|
||||
namespace nix {
|
||||
|
||||
DownloadSettings downloadSettings;
|
||||
DataTransferSettings dataTransferSettings;
|
||||
|
||||
static GlobalConfig::Register r1(&downloadSettings);
|
||||
static GlobalConfig::Register r1(&dataTransferSettings);
|
||||
|
||||
std::string resolveUri(const std::string & uri)
|
||||
{
|
||||
|
@ -257,12 +257,12 @@ struct CurlDownloader : public Downloader
|
|||
curl_easy_setopt(req, CURLOPT_NOSIGNAL, 1);
|
||||
curl_easy_setopt(req, CURLOPT_USERAGENT,
|
||||
("curl/" LIBCURL_VERSION " Nix/" + nixVersion +
|
||||
(downloadSettings.userAgentSuffix != "" ? " " + downloadSettings.userAgentSuffix.get() : "")).c_str());
|
||||
(dataTransferSettings.userAgentSuffix != "" ? " " + dataTransferSettings.userAgentSuffix.get() : "")).c_str());
|
||||
#if LIBCURL_VERSION_NUM >= 0x072b00
|
||||
curl_easy_setopt(req, CURLOPT_PIPEWAIT, 1);
|
||||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x072f00
|
||||
if (downloadSettings.enableHttp2)
|
||||
if (dataTransferSettings.enableHttp2)
|
||||
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
||||
else
|
||||
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
|
@ -297,10 +297,10 @@ struct CurlDownloader : public Downloader
|
|||
curl_easy_setopt(req, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
||||
curl_easy_setopt(req, CURLOPT_CONNECTTIMEOUT, downloadSettings.connectTimeout.get());
|
||||
curl_easy_setopt(req, CURLOPT_CONNECTTIMEOUT, dataTransferSettings.connectTimeout.get());
|
||||
|
||||
curl_easy_setopt(req, CURLOPT_LOW_SPEED_LIMIT, 1L);
|
||||
curl_easy_setopt(req, CURLOPT_LOW_SPEED_TIME, downloadSettings.stalledDownloadTimeout.get());
|
||||
curl_easy_setopt(req, CURLOPT_LOW_SPEED_TIME, dataTransferSettings.stalledDownloadTimeout.get());
|
||||
|
||||
/* If no file exist in the specified path, curl continues to work
|
||||
anyway as if netrc support was disabled. */
|
||||
|
@ -469,7 +469,7 @@ struct CurlDownloader : public Downloader
|
|||
#endif
|
||||
#if LIBCURL_VERSION_NUM >= 0x071e00 // Max connections requires >= 7.30.0
|
||||
curl_multi_setopt(curlm, CURLMOPT_MAX_TOTAL_CONNECTIONS,
|
||||
downloadSettings.httpConnections.get());
|
||||
dataTransferSettings.httpConnections.get());
|
||||
#endif
|
||||
|
||||
wakeupPipe.create();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
struct DownloadSettings : Config
|
||||
struct DataTransferSettings : Config
|
||||
{
|
||||
Setting<bool> enableHttp2{this, true, "http2",
|
||||
"Whether to enable HTTP/2 support."};
|
||||
|
@ -31,7 +31,7 @@ struct DownloadSettings : Config
|
|||
"How often Nix will attempt to download a file before giving up."};
|
||||
};
|
||||
|
||||
extern DownloadSettings downloadSettings;
|
||||
extern DataTransferSettings dataTransferSettings;
|
||||
|
||||
struct DataTransferRequest
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ struct DataTransferRequest
|
|||
std::string expectedETag;
|
||||
bool verifyTLS = true;
|
||||
bool head = false;
|
||||
size_t tries = downloadSettings.tries;
|
||||
size_t tries = dataTransferSettings.tries;
|
||||
unsigned int baseRetryTimeMs = 250;
|
||||
ActivityId parentAct;
|
||||
bool decompress = true;
|
||||
|
|
|
@ -176,10 +176,10 @@ void mainWrapped(int argc, char * * argv)
|
|||
settings.useSubstitutes = false;
|
||||
if (!settings.tarballTtl.overriden)
|
||||
settings.tarballTtl = std::numeric_limits<unsigned int>::max();
|
||||
if (!downloadSettings.tries.overriden)
|
||||
downloadSettings.tries = 0;
|
||||
if (!downloadSettings.connectTimeout.overriden)
|
||||
downloadSettings.connectTimeout = 1;
|
||||
if (!dataTransferSettings.tries.overriden)
|
||||
dataTransferSettings.tries = 0;
|
||||
if (!dataTransferSettings.connectTimeout.overriden)
|
||||
dataTransferSettings.connectTimeout = 1;
|
||||
}
|
||||
|
||||
if (args.refresh)
|
||||
|
|
Loading…
Reference in a new issue