cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: speed limit / speed time / limit rate

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Sun, 15 Feb 2004 18:11:53 +0100 (CET)

On Thu, 12 Feb 2004, David Byron wrote:

> I've run across a bit of a strange situation. I think I've shot myself in
> the foot.
>
> Let's say you invoke curl like this:
>
> $ curl --remote-name --speed-limit 2 --speed-time 30 --limit-rate 1K <some
> url where a big file lives>
>
> I've looked at the code in my_fwrite() in src/main.c. I'm trying to figure
> out if the the 1K limit can cause the speed-limit to fire and cancel the
> download. It doesn't appear there's any limit on the sleep in my_fwrite.

So yes, it can. The --speed-* options are provided by the library, while the
--limit-rate stuff is done purely in the app-side.

> "If curl receives more than 31K of data in one second, it'll go to sleep for
> 30 seconds, triggering the speed limit and basically killing itself"

Yeps.

> Is there a way to do what I want though -- where what I want is to limit the
> bandwidth, but cancel if the link really is bad?
>
> I haven't looked at where the info resides, but is it feasible/a good thing
> for my_write to check the argument to --speed-time and never sleep for long
> enough to trigger it?

I think you have a valid point and we should look into how we solve this the
best way. I haven't really given it any real thoughts yet...

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
Received on 2004-02-15