forked from lix-project/lix
DownloadSettings -> DataTransferSettings
This commit is contained in:
parent
741e9012d3
commit
e5cc53beec
|
@ -27,9 +27,9 @@ using namespace std::string_literals;
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
DownloadSettings downloadSettings;
|
DataTransferSettings dataTransferSettings;
|
||||||
|
|
||||||
static GlobalConfig::Register r1(&downloadSettings);
|
static GlobalConfig::Register r1(&dataTransferSettings);
|
||||||
|
|
||||||
std::string resolveUri(const std::string & uri)
|
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_NOSIGNAL, 1);
|
||||||
curl_easy_setopt(req, CURLOPT_USERAGENT,
|
curl_easy_setopt(req, CURLOPT_USERAGENT,
|
||||||
("curl/" LIBCURL_VERSION " Nix/" + nixVersion +
|
("curl/" LIBCURL_VERSION " Nix/" + nixVersion +
|
||||||
(downloadSettings.userAgentSuffix != "" ? " " + downloadSettings.userAgentSuffix.get() : "")).c_str());
|
(dataTransferSettings.userAgentSuffix != "" ? " " + dataTransferSettings.userAgentSuffix.get() : "")).c_str());
|
||||||
#if LIBCURL_VERSION_NUM >= 0x072b00
|
#if LIBCURL_VERSION_NUM >= 0x072b00
|
||||||
curl_easy_setopt(req, CURLOPT_PIPEWAIT, 1);
|
curl_easy_setopt(req, CURLOPT_PIPEWAIT, 1);
|
||||||
#endif
|
#endif
|
||||||
#if LIBCURL_VERSION_NUM >= 0x072f00
|
#if LIBCURL_VERSION_NUM >= 0x072f00
|
||||||
if (downloadSettings.enableHttp2)
|
if (dataTransferSettings.enableHttp2)
|
||||||
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
||||||
else
|
else
|
||||||
curl_easy_setopt(req, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
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_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_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
|
/* If no file exist in the specified path, curl continues to work
|
||||||
anyway as if netrc support was disabled. */
|
anyway as if netrc support was disabled. */
|
||||||
|
@ -469,7 +469,7 @@ struct CurlDownloader : public Downloader
|
||||||
#endif
|
#endif
|
||||||
#if LIBCURL_VERSION_NUM >= 0x071e00 // Max connections requires >= 7.30.0
|
#if LIBCURL_VERSION_NUM >= 0x071e00 // Max connections requires >= 7.30.0
|
||||||
curl_multi_setopt(curlm, CURLMOPT_MAX_TOTAL_CONNECTIONS,
|
curl_multi_setopt(curlm, CURLMOPT_MAX_TOTAL_CONNECTIONS,
|
||||||
downloadSettings.httpConnections.get());
|
dataTransferSettings.httpConnections.get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wakeupPipe.create();
|
wakeupPipe.create();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
struct DownloadSettings : Config
|
struct DataTransferSettings : Config
|
||||||
{
|
{
|
||||||
Setting<bool> enableHttp2{this, true, "http2",
|
Setting<bool> enableHttp2{this, true, "http2",
|
||||||
"Whether to enable HTTP/2 support."};
|
"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."};
|
"How often Nix will attempt to download a file before giving up."};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DownloadSettings downloadSettings;
|
extern DataTransferSettings dataTransferSettings;
|
||||||
|
|
||||||
struct DataTransferRequest
|
struct DataTransferRequest
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ struct DataTransferRequest
|
||||||
std::string expectedETag;
|
std::string expectedETag;
|
||||||
bool verifyTLS = true;
|
bool verifyTLS = true;
|
||||||
bool head = false;
|
bool head = false;
|
||||||
size_t tries = downloadSettings.tries;
|
size_t tries = dataTransferSettings.tries;
|
||||||
unsigned int baseRetryTimeMs = 250;
|
unsigned int baseRetryTimeMs = 250;
|
||||||
ActivityId parentAct;
|
ActivityId parentAct;
|
||||||
bool decompress = true;
|
bool decompress = true;
|
||||||
|
|
|
@ -176,10 +176,10 @@ void mainWrapped(int argc, char * * argv)
|
||||||
settings.useSubstitutes = false;
|
settings.useSubstitutes = false;
|
||||||
if (!settings.tarballTtl.overriden)
|
if (!settings.tarballTtl.overriden)
|
||||||
settings.tarballTtl = std::numeric_limits<unsigned int>::max();
|
settings.tarballTtl = std::numeric_limits<unsigned int>::max();
|
||||||
if (!downloadSettings.tries.overriden)
|
if (!dataTransferSettings.tries.overriden)
|
||||||
downloadSettings.tries = 0;
|
dataTransferSettings.tries = 0;
|
||||||
if (!downloadSettings.connectTimeout.overriden)
|
if (!dataTransferSettings.connectTimeout.overriden)
|
||||||
downloadSettings.connectTimeout = 1;
|
dataTransferSettings.connectTimeout = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.refresh)
|
if (args.refresh)
|
||||||
|
|
Loading…
Reference in a new issue