From: Guus Sliepen Date: Tue, 27 Feb 2018 18:11:38 +0000 (+0100) Subject: Revert "Unconditionally remove timeouts from the queue before calling the callback." X-Git-Tag: release-1.1pre16~17 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d661c7c7353da90911e9f2d0195ac861d6837f5c;p=oweals%2Ftinc.git Revert "Unconditionally remove timeouts from the queue before calling the callback." This reverts commit e8a60109fc91a42420ec626b63956771675f89b0. --- diff --git a/src/event.c b/src/event.c index 33d205a..331872a 100644 --- a/src/event.c +++ b/src/event.c @@ -300,9 +300,11 @@ static struct timeval *get_time_remaining(struct timeval *diff) { timersub(&timeout->tv, &now, diff); if(diff->tv_sec < 0) { - timeout_cb_t cb = timeout->cb; - timeout_del(timeout); - cb(timeout->data); + timeout->cb(timeout->data); + + if(timercmp(&timeout->tv, &now, <)) { + timeout_del(timeout); + } } else { tv = diff; break;