[dovecot-cvs] dovecot/src/lib Makefile.am,1.10,1.11 ioloop-poll.c,1.3,1.4 ioloop-select.c,1.3,1.4
cras at procontrol.fi
cras at procontrol.fi
Tue Nov 26 12:28:42 EET 2002
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv6295/src/lib
Modified Files:
Makefile.am ioloop-poll.c ioloop-select.c
Log Message:
select() support was broken. Also changed the way it's built.
Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/lib/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 28 Oct 2002 04:18:26 -0000 1.10
+++ Makefile.am 26 Nov 2002 10:28:40 -0000 1.11
@@ -1,15 +1,5 @@
noinst_LIBRARIES = liblib.a
-if IOLOOP_POLL
-ioloop_source = ioloop-poll.c
-else
-ioloop_source = ioloop-select.c
-endif
-
-ioloop_sources = \
- ioloop-poll.c \
- ioloop-select.c
-
liblib_a_SOURCES = \
alarm-hup.c \
base64.c \
@@ -29,7 +19,8 @@
ibuffer-file.c \
ibuffer-mmap.c \
ioloop.c \
- $(ioloop_source) \
+ ioloop-poll.c \
+ ioloop-select.c \
lib.c \
lib-signals.c \
md5.c \
@@ -92,6 +83,3 @@
utc-offset.h \
utc-mktime.h \
write-full.h
-
-EXTRA_DIST = \
- $(ioloop_sources)
Index: ioloop-poll.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ioloop-poll.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ioloop-poll.c 28 Oct 2002 04:50:14 -0000 1.3
+++ ioloop-poll.c 26 Nov 2002 10:28:40 -0000 1.4
@@ -26,6 +26,8 @@
#include "lib.h"
#include "ioloop-internal.h"
+#ifdef IOLOOP_POLL
+
#include <sys/poll.h>
#ifndef INITIAL_POLL_FDS
@@ -212,3 +214,5 @@
io_destroy(ioloop, io);
}
}
+
+#endif
Index: ioloop-select.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/ioloop-select.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ioloop-select.c 26 Nov 2002 10:14:28 -0000 1.3
+++ ioloop-select.c 26 Nov 2002 10:28:40 -0000 1.4
@@ -26,6 +26,8 @@
#include "lib.h"
#include "ioloop-internal.h"
+#ifdef IOLOOP_SELECT
+
#include <sys/types.h>
#include <unistd.h>
@@ -97,27 +99,33 @@
}
/* execute the I/O handlers in prioritized order */
- for (io = ioloop->ios; io != NULL; io = next) {
+ for (io = ioloop->ios; io != NULL && ret > 0; io = next) {
next = io->next;
+ if (io->destroyed) {
+ /* we were destroyed, and io->fd points to -1 now. */
+ io_destroy(ioloop, io);
+ continue;
+ }
+
+ i_assert(io->fd >= 0);
+
fd = io->fd;
condition = io->condition;
- destroyed = io->destroyed;
- if (destroyed)
- io_destroy(ioloop, io);
-
if (!io_check_condition(fd, condition))
continue;
- if (!destroyed) {
- t_id = t_push();
- io->func(io->context, io->fd, io);
- if (t_pop() != t_id)
- i_panic("Leaked a t_pop() call!");
- }
+ t_id = t_push();
+ io->func(io->context, io->fd, io);
+ if (t_pop() != t_id)
+ i_panic("Leaked a t_pop() call!");
- if (--ret == 0)
- break;
+ if (io->destroyed)
+ io_destroy(ioloop, io);
+
+ ret--;
}
}
+
+#endif
More information about the dovecot-cvs
mailing list