Additional commentary on total_written and rate limiting.

This commit is contained in:
Andrew Wood
2026-05-09 20:24:49 +01:00
parent 4fc5d10671
commit adf2767763
+10
View File
@@ -639,6 +639,16 @@ int pv_main_loop(pvstate_t state)
return state->status.exit_status;
}
/*
* Increment the total_written counter (lines or bytes
* depending on line mode) by the amount written.
*
* If rate limiting is active, subtract the amount written
* from the target amount to transfer. Whatever
* (fractional) value is left will carry over to the next
* loop iteration so that the transfer rate will average out
* to the requested rate.
*/
if (state->control.linemode) {
state->transfer.total_written += lineswritten;
if (state->control.rate_limit_active)