[pacman-dev] [PATCH 1/2] dload: abort transfer on CURLOPT_LOW_SPEED_LIMIT
Dan McGee
dpmcgee at gmail.com
Wed Jun 1 15:37:52 EDT 2011
On Wed, Jun 1, 2011 at 2:24 PM, Dave Reisner <d at falconindy.com> wrote:
> If a connection drops below 10kb/s for 10s, curl will kill the transfer
> and we'll report failure.
Yeah, the sad catch here is even 56K modems would max out at 56,600
bps == 7,000 B/sec == 6.84 KB/sec, which is below the 10K cutoff. From
the manpage which uses these opts directly:
If a download is slower than speed-limit bytes per second during
a speed-time period, the download gets aborted. If speed-time is
used, the default speed-limit will be 1 unless set with -Y.
So it seems like it is only looked at over the limit time, not the
entire length of the download as you mentioned elsewhere. The code in
lib/speedcheck.c seems to confirm this.
So I guess I'd advocate for a value below what a 28.8 K modem would
give, just so you don't frustrate someone trying to download a small
package over dial-up more than necessary. Something like 1200 would
put it even below the 14.4K mark, and yet with the limit of 10 seconds
would probably still do a good job here.
> Signed-off-by: Dave Reisner <d at falconindy.com>
> ---
> lib/libalpm/dload.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index d024c73..3d90130 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -194,6 +194,8 @@ static int curl_download_internal(const char *url, const char *localpath,
> curl_easy_setopt(handle->curl, CURLOPT_FOLLOWLOCATION, 1L);
> curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
> curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void *)&dlfile);
> + curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_LIMIT, 10240L);
> + curl_easy_setopt(handle->curl, CURLOPT_LOW_SPEED_TIME, 10L);
>
> useragent = getenv("HTTP_USER_AGENT");
> if(useragent != NULL) {
> --
> 1.7.5.2
>
>
>
More information about the pacman-dev
mailing list