From: Timo Sirainen Date: Sun, 30 Nov 2008 13:04:29 +0000 (+0200) Subject: ioloop: 0 ms timeouts could still have caused infinite looping. X-Git-Tag: 1.2.alpha5~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=421bd1f3e8f7ce7cc7879f2209d0293ce9cce0c0;p=thirdparty%2Fdovecot%2Fcore.git ioloop: 0 ms timeouts could still have caused infinite looping. --HG-- branch : HEAD --- diff --git a/src/lib/ioloop.c b/src/lib/ioloop.c index a5b48ec823..7c505c986b 100644 --- a/src/lib/ioloop.c +++ b/src/lib/ioloop.c @@ -157,8 +157,9 @@ timeout_reset_timeval(struct timeout *timeout, struct timeval *tv_now) if (timeout->msecs == 0) { /* if we came here from io_loop_handle_timeouts(), next_run must be larger than tv_now or we could go to - infinite loop */ - timeout->next_run.tv_usec += 1000; + infinite loop. +1000 to get 1 ms further, another +1000 to + account for timeout_update_next()'s truncation. */ + timeout->next_run.tv_usec += 2000; if (timeout->next_run.tv_usec >= 1000000) { timeout->next_run.tv_sec++; timeout->next_run.tv_usec -= 1000000;