From 975b8ad1bcaf873a2529bff584624884d35354e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Tue, 18 Mar 2014 22:33:32 +0100 Subject: [PATCH] no need for clamping to funds + 1, just to funds --- src/rate_limit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rate_limit.c b/src/rate_limit.c index 2facdc1..a2ad6ef 100644 --- a/src/rate_limit.c +++ b/src/rate_limit.c @@ -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;