summaryrefslogtreecommitdiff
path: root/src/ratelimit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-02-08 21:35:49 +0100
committerLennart Poettering <lennart@poettering.net>2012-02-08 21:35:49 +0100
commitcafac610a7c8841dfc442518ec12cd306a4622cf (patch)
tree518a2c7a20b5749a437b0ea90b8608e191cc346b /src/ratelimit.c
parente8ab3ccba4232825dd5a54f8516ce42df228f27f (diff)
ratelimit: if interval/burst are set to 0, assume ratelimiting shall be disabled
Diffstat (limited to 'src/ratelimit.c')
-rw-r--r--src/ratelimit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ratelimit.c b/src/ratelimit.c
index 1ddc83187f..93157c7a2e 100644
--- a/src/ratelimit.c
+++ b/src/ratelimit.c
@@ -30,11 +30,12 @@
bool ratelimit_test(RateLimit *r) {
usec_t ts;
- ts = now(CLOCK_MONOTONIC);
-
assert(r);
- assert(r->interval > 0);
- assert(r->burst > 0);
+
+ if (r->interval <= 0 || r->burst <= 0)
+ return true;
+
+ ts = now(CLOCK_MONOTONIC);
if (r->begin <= 0 ||
r->begin + r->interval < ts) {