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 f9fffbc4b0
commit 975b8ad1bc
+3 -3
View File
@@ -32,9 +32,9 @@ static void uc_ratelimit_refill(struct RateLimit *r, long current_ts)
//Find elapsed time
diff_period = current_ts - r->last_refill_ts;
if (diff_period > r->period + 1) {
//help prevent overflow when calculating available_tickets below
diff_period = r->period + 1;
if (diff_period > r->period) {
//help prevent overflow when calculating available tickets below
diff_period = r->period;
} else if (diff_period < 0) {
//time went backwards, skip this round
diff_period = 0;