From 0028c8ced8bec5f76c36bb0855189965dbce203a Mon Sep 17 00:00:00 2001 From: ruti <> Date: Sun, 9 Feb 2025 13:28:33 +0300 Subject: [PATCH] Fix timer if time diff is zero --- conev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conev.c b/conev.c index a2b3455..9caea9c 100644 --- a/conev.c +++ b/conev.c @@ -291,14 +291,14 @@ void remove_timer(struct poolhd *pool, struct eval *val) struct eval *next_event_tv(struct poolhd *pool, int *offs, int *type) { - int ms = 0; + if (!pool->tv_start) { + return next_event(pool, offs, type, -1); + } struct eval *val = 0; - if (pool->tv_start) { - ms = pool->tv_start->tv_ms - time_ms(); - } - if (ms >= 0) { - val = next_event(pool, offs, type, ms ? ms : -1); + int ms = pool->tv_start->tv_ms - time_ms(); + if (ms > 0) { + val = next_event(pool, offs, type, ms); } else *type = POLLTIMEOUT;