[throttle] fix connection throttling refill calculation

personal/stbuehler/wip
Stefan Bühler 9 years ago
parent a1170b3aec
commit bfa1395937
  1. 2
      src/main/throttle.c

@ -173,7 +173,7 @@ guint li_throttle_query(liWorker *wrk, liThrottleState *state, guint interested,
fill = interested - state->magazine;
if (state->single_rate != 0) {
if (now - state->single_last_rearm >= LI_THROTTLE_GRANULARITY) {
guint single_fill = ((guint64) state->single_rate) * 1000u / (now - state->single_last_rearm);
guint single_fill = (((guint64) state->single_rate) * (now - state->single_last_rearm)) / 1000u;
state->single_last_rearm = now;
if (state->single_burst - state->single_magazine < single_fill) {
state->single_magazine = state->single_burst;

Loading…
Cancel
Save