ratelimit: reset on start

On any `Curl_rlimit_start()` the rate limit needs to reset its
values before calculating the effective step duration and adjust
the tokens/burst per step.

Add two fields to the struct to remember the original values.

Closes #21086
This commit is contained in:
Stefan Eissing 2026-03-24 13:41:51 +01:00 committed by Daniel Stenberg
parent 372d721e92
commit 797bc316bf
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 10 additions and 3 deletions

View file

@ -55,6 +55,8 @@ struct Curl_easy;
*/
struct Curl_rlimit {
int64_t rate_per_sec; /* rate tokens generated per second */
int64_t burst_per_sec; /* burst rate of tokens per second */
int64_t rate_per_step; /* rate tokens generated per step us */
int64_t burst_per_step; /* burst rate of tokens per step us */
timediff_t step_us; /* microseconds between token increases */