curl / Mailing Lists / curl-library / Single Mail


Re: [curl/curl] 04b61f: progress: fix rate-limit for high speed transfers

From: Ben Greear <>
Date: Tue, 20 Mar 2018 16:05:16 -0700

On 03/15/2018 08:47 AM, GitHub wrote:
> Branch: refs/heads/bagder/rate-limit-longer-period
> Home:
> Commit: 04b61f36d8bf6d0de85e8d2164617f953dd966e7
> Author: Daniel Stenberg <>
> Date: 2018-03-15 (Thu, 15 Mar 2018)
> Changed paths:
> M lib/multi.c
> M lib/progress.c
> M lib/progress.h
> Log Message:
> -----------
> progress: fix rate-limit for high speed transfers
> Due to very frequent updates of the rate limit "window", it could
> attempt to limit within the same milliseconds and that then made the
> calculations wrong, leading to it not behaving correctly on very fast
> transfers.
> This new logic updates the rate limit "window" to be no shorter than the
> last three seconds and only updating the timestamps for this when
> switching between the states TOOFAST/PERFORM.


As far as I can tell, this patch is broken. I am downloading a 20MB file
using ftp, with a program compiled against lib-curl. With this patch,
download spikes to 150Mbps (or probably higher, depending on resolution), and then
has a long pause for the next URL (that pause might be caused by my own rate-ctrl
across URLs).

Without this patch, the download rate hovers around the requested 5Mbps
download rate.

If you are having issues with the rate-ctrl logic happening too quickly, maybe
just record the last ms timestamp you were in the call and bail out until at least
1ms has passed?

How fast of a transfer did you test this patch with? And/or, what speed showed the
previous problem you are trying to fix?


> Reported-by: 刘佩东
> Fixes #2396
> _______________________________________________
> curl-commits mailing list

Ben Greear <>
Candela Technologies Inc
Received on 2018-03-21