chiark / gitweb /
socket: add option for SO_PASSEC
[elogind.git] / src / ratelimit.c
index 1ddc83187f59295fc2402a63a75fa637fbf88210..93157c7a2e071cb177676909e04cab3be11d54ed 100644 (file)
 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) {