]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Prevent crash in ioloop
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 16 Sep 2016 12:49:36 +0000 (15:49 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 20 Sep 2016 08:50:30 +0000 (11:50 +0300)
If only non-fd sources and no timeouts are
in ioloop, prevent crash and unnecessary
waiting when there are pending IOs.

src/lib/ioloop.c

index eab5624d21345b326595c897fa113f4a52b809d6..640f3fb10d723ab637d24013d5d786cacfc4e26b 100644 (file)
@@ -393,6 +393,10 @@ int io_loop_get_wait_time(struct ioloop *ioloop, struct timeval *tv_r)
        struct timeout *timeout;
        int msecs;
 
+       /* if there are pending io, do not wait, possibly
+           forever, for them, but process them directly. */
+       if (current_ioloop->io_pending_count > 0) return 0;
+
        item = priorityq_peek(ioloop->timeouts);
        timeout = (struct timeout *)item;
        if (timeout == NULL) {