no need for clamping to funds + 1, just to funds

This commit is contained in:
Nils O. Selåsdal
2014-03-18 22:33:32 +01:00
parent 71c9643ee9
commit c9656fbb3c
+3 -3
View File
@@ -32,9 +32,9 @@ static void uc_ratelimit_refill(struct RateLimit *r, long current_ts)
//Find elapsed time //Find elapsed time
diff_period = current_ts - r->last_refill_ts; diff_period = current_ts - r->last_refill_ts;
if (diff_period > r->period + 1) { if (diff_period > r->period) {
//help prevent overflow when calculating available_tickets below //help prevent overflow when calculating available tickets below
diff_period = r->period + 1; diff_period = r->period;
} else if (diff_period < 0) { } else if (diff_period < 0) {
//time went backwards, skip this round //time went backwards, skip this round
diff_period = 0; diff_period = 0;