changeset 4580:4644b3038b9a HEAD

Reference IOs before calling timeout handlers, in case they call io_remove().
author Timo Sirainen <tss@iki.fi>
date Thu, 17 Aug 2006 21:52:58 +0300
parents 40b353def38c
children c25c0ae8f1f0
files src/lib/ioloop-kqueue.c
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop-kqueue.c	Thu Aug 17 21:46:42 2006 +0300
+++ b/src/lib/ioloop-kqueue.c	Thu Aug 17 21:52:58 2006 +0300
@@ -122,18 +122,15 @@
 	if (ret < 0 && errno != EINTR)
 		i_fatal("kevent(): %m");
 
-	/* execute timeout handlers */
-	io_loop_handle_timeouts(ioloop);
-
-	if (!ioloop->running)
-		return;
-
 	/* reference all IOs */
 	for (i = 0; i < ret; i++) {
 		io = events[i].udata;
 		io->refcount++;
 	}
 
+	/* execute timeout handlers */
+	io_loop_handle_timeouts(ioloop);
+
 	for (i = 0; i < ret; i++) {
 		/* io_loop_handle_add() may cause events array reallocation,
 		   so we have use array_idx() */