forked from lix-project/lix
Merge pull request #3031 from grahamc/low-speed-limit
conf: stalled-download-timeout: make tunable
This commit is contained in:
commit
35ebae198f
|
@ -873,6 +873,14 @@ password <replaceable>my-password</replaceable>
|
||||||
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry xml:id="conf-stalled-download-timeout"><term><literal>stalled-download-timeout</literal></term>
|
||||||
|
<listitem>
|
||||||
|
<para>The timeout (in seconds) for receiving data from servers
|
||||||
|
during download. Nix cancels idle downloads after this timeout's
|
||||||
|
duration.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry xml:id="conf-substituters"><term><literal>substituters</literal></term>
|
<varlistentry xml:id="conf-substituters"><term><literal>substituters</literal></term>
|
||||||
|
|
||||||
<listitem><para>A list of URLs of substituters, separated by
|
<listitem><para>A list of URLs of substituters, separated by
|
||||||
|
|
|
@ -236,8 +236,6 @@ struct CurlDownloader : public Downloader
|
||||||
return ((DownloadItem *) userp)->readCallback(buffer, size, nitems);
|
return ((DownloadItem *) userp)->readCallback(buffer, size, nitems);
|
||||||
}
|
}
|
||||||
|
|
||||||
long lowSpeedTimeout = 300;
|
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
if (!req) req = curl_easy_init();
|
if (!req) req = curl_easy_init();
|
||||||
|
@ -297,7 +295,7 @@ struct CurlDownloader : public Downloader
|
||||||
curl_easy_setopt(req, CURLOPT_CONNECTTIMEOUT, downloadSettings.connectTimeout.get());
|
curl_easy_setopt(req, CURLOPT_CONNECTTIMEOUT, downloadSettings.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, lowSpeedTimeout);
|
curl_easy_setopt(req, CURLOPT_LOW_SPEED_TIME, downloadSettings.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. */
|
||||||
|
|
|
@ -24,6 +24,9 @@ struct DownloadSettings : Config
|
||||||
Setting<unsigned long> connectTimeout{this, 0, "connect-timeout",
|
Setting<unsigned long> connectTimeout{this, 0, "connect-timeout",
|
||||||
"Timeout for connecting to servers during downloads. 0 means use curl's builtin default."};
|
"Timeout for connecting to servers during downloads. 0 means use curl's builtin default."};
|
||||||
|
|
||||||
|
Setting<unsigned long> stalledDownloadTimeout{this, 300, "stalled-download-timeout",
|
||||||
|
"Timeout (in seconds) for receiving data from servers during download. Nix cancels idle downloads after this timeout's duration."};
|
||||||
|
|
||||||
Setting<unsigned int> tries{this, 5, "download-attempts",
|
Setting<unsigned int> tries{this, 5, "download-attempts",
|
||||||
"How often Nix will attempt to download a file before giving up."};
|
"How often Nix will attempt to download a file before giving up."};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue