aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-08-31 12:52:11 -0400
committerNick Mathewson <nickm@torproject.org>2010-08-31 12:52:11 -0400
commit285addbd943cbc9e96c0a268f4f45510270b4468 (patch)
tree0c9c8b606e9d13501fe29a96d7af97704e830123 /src/common/util.c
parentba9c1275c4b2325aed6a2fe2cc236794dab11052 (diff)
downloadtor-285addbd943cbc9e96c0a268f4f45510270b4468.tar.gz
tor-285addbd943cbc9e96c0a268f4f45510270b4468.zip
Fix some issues in rate-limiting noticed by Sebastian
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 3c735e9c7c..2781fa35d6 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1584,10 +1584,10 @@ ftime_definitely_before(time_t now, time_t when)
/** If the rate-limiter <b>lim</b> is ready at <b>now</b>, return the number
* of calls to rate_limit_is_ready (including this one!) since the last time
* rate_limit_is_ready returned nonzero. Otherwise return 0. */
-int
+static int
rate_limit_is_ready(ratelim_t *lim, time_t now)
{
- if (lim->rate + lim->last_allowed >= now) {
+ if (lim->rate + lim->last_allowed <= now) {
int res = lim->n_calls_since_last_time + 1;
lim->last_allowed = now;
lim->n_calls_since_last_time = 0;