Merge branch 'main' of https://github.com/vbychkoviak/pv into vbychkoviak-main

This commit is contained in:
Andrew Wood
2023-07-16 11:23:46 +01:00
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -34,6 +34,7 @@ extern "C" {
#define PV_DISPLAY_FINETA 512
#define RATE_GRANULARITY 100000 /* usec between -L rate chunks */
#define RATE_BURST_WINDOW 5 /* rate burst window (multiples of rate) */
#define REMOTE_INTERVAL 100000 /* usec between checks for -R */
#define BUFFER_SIZE 409600 /* default transfer buffer size */
#define BUFFER_SIZE_MAX 524288 /* max auto transfer buffer size */
+5
View File
@@ -151,10 +151,15 @@ int pv_main_loop(pvstate_t state)
|| (cur_time.tv_sec == next_ratecheck.tv_sec
&& cur_time.tv_usec >=
next_ratecheck.tv_usec)) {
target +=
((long double) (state->rate_limit)) /
(long double) (1000000 /
RATE_GRANULARITY);
long double burstMax = ((long double) (state->rate_limit * RATE_BURST_WINDOW));
if (target > burstMax) {
target = burstMax;
}
pv_timeval_add_usec(&next_ratecheck,
RATE_GRANULARITY);
}