ratelimit: fix integer overflow
If StartLimitIntervalSec is huge, or more specifically, set to "infinity", we need to take care about overflows.
This commit is contained in:
parent
7a5b649fc0
commit
e2357b1c8a
|
@ -19,7 +19,7 @@ bool ratelimit_below(RateLimit *r) {
|
|||
ts = now(CLOCK_MONOTONIC);
|
||||
|
||||
if (r->begin <= 0 ||
|
||||
r->begin + r->interval < ts) {
|
||||
ts - r->begin > r->interval) {
|
||||
r->begin = ts;
|
||||
|
||||
/* Reset counter */
|
||||
|
|
Loading…
Reference in New Issue