]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
io_loop_run() now assert-crashes if it's attempted to be used recursively for the...
authorTimo Sirainen <tss@iki.fi>
Wed, 23 Oct 2013 11:35:07 +0000 (14:35 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 23 Oct 2013 11:35:07 +0000 (14:35 +0300)
src/lib/ioloop-private.h
src/lib/ioloop.c

index e24202b11b485c1d2df40dde463828bb6e0fc975..afbe39d6ae6dd8c2ee75218818fc0b39cad90b98 100644 (file)
@@ -25,6 +25,7 @@ struct ioloop {
        time_t next_max_time;
 
        unsigned int running:1;
+       unsigned int iolooping:1;
 };
 
 struct io {
index 179507cc7221cba5b57dbee4ae735b54fabfd8dd..8d1b429968015bfa32d8908549b45baacd2e7aa4 100644 (file)
@@ -401,9 +401,15 @@ void io_loop_run(struct ioloop *ioloop)
        if (ioloop->cur_ctx != NULL)
                io_loop_context_unref(&ioloop->cur_ctx);
 
+       /* recursive io_loop_run() isn't allowed for the same ioloop.
+          it can break backends. */
+       i_assert(!ioloop->iolooping);
+       ioloop->iolooping = TRUE;
+
        ioloop->running = TRUE;
        while (ioloop->running)
                io_loop_handler_run(ioloop);
+       ioloop->iolooping = FALSE;
 }
 
 void io_loop_stop(struct ioloop *ioloop)