no need for clamping to funds + 1, just to funds
This commit is contained in:
+3
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user