[systemd-commits] src/ratelimit.c

Lennart Poettering lennart at kemper.freedesktop.org
Wed Feb 8 12:35:55 PST 2012


 src/ratelimit.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit cafac610a7c8841dfc442518ec12cd306a4622cf
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 8 21:35:49 2012 +0100

    ratelimit: if interval/burst are set to 0, assume ratelimiting shall be disabled

diff --git a/src/ratelimit.c b/src/ratelimit.c
index 1ddc831..93157c7 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) {



More information about the systemd-commits mailing list