From: Timo Sirainen Date: Sat, 24 May 2003 15:16:47 +0000 (+0300) Subject: bugfixes X-Git-Tag: 1.1.alpha1~4604 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1a0d73d7dc03669b36f12a8af9978de361ad06;p=thirdparty%2Fdovecot%2Fcore.git bugfixes --HG-- branch : HEAD --- diff --git a/src/lib/ioloop-poll.c b/src/lib/ioloop-poll.c index 32189a0409..b02885ee86 100644 --- a/src/lib/ioloop-poll.c +++ b/src/lib/ioloop-poll.c @@ -212,8 +212,10 @@ void io_loop_handler_run(struct ioloop *ioloop) if (t_pop() != t_id) i_panic("Leaked a t_pop() call!"); - if (io->destroyed) + if (io->destroyed) { io_destroy(ioloop, io_p); + continue; + } } } diff --git a/src/lib/ioloop-select.c b/src/lib/ioloop-select.c index c091e2739d..e6d0c66720 100644 --- a/src/lib/ioloop-select.c +++ b/src/lib/ioloop-select.c @@ -121,15 +121,17 @@ void io_loop_handler_run(struct ioloop *ioloop) condition = io->condition; if (io_check_condition(fd, condition)) { + ret--; + t_id = t_push(); io->callback(io->context); if (t_pop() != t_id) i_panic("Leaked a t_pop() call!"); - if (io->destroyed) + if (io->destroyed) { io_destroy(ioloop, io_p); - - ret--; + continue; + } } io_p = &io->next; diff --git a/src/lib/ioloop.c b/src/lib/ioloop.c index 484138304e..735de50fe7 100644 --- a/src/lib/ioloop.c +++ b/src/lib/ioloop.c @@ -58,7 +58,7 @@ static void update_highest_fd(struct ioloop *ioloop) struct io *io_add(int fd, int condition, io_callback_t *callback, void *context) { - struct io *io; + struct io *io, **io_p; i_assert(fd >= 0); i_assert(callback != NULL); @@ -75,8 +75,11 @@ struct io *io_add(int fd, int condition, io_callback_t *callback, void *context) io_loop_handle_add(current_ioloop, io->fd, io->condition); - io->next = current_ioloop->ios; - current_ioloop->ios = io; + /* have to append it, or io_destroy() breaks */ + io_p = ¤t_ioloop->ios; + while (*io_p != NULL) + io_p = &(*io_p)->next; + *io_p = io; return io; }