From 82d323d6c1cd8f876f92f2744b16f0540ad19d15 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Wed, 4 Oct 2006 01:32:57 +0000 Subject: [PATCH] Fix some startup-related glitches. src/ioset.h (ioset_update): Declare new function. src/ioset.c (ioset_init): If we have an engine, return early. (ioset_add): If no engine, try to initialize. (ioset_update): New function. git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-52 --- ChangeLog | 17 +++++++++++++++++ src/ioset.c | 9 ++++++++- src/ioset.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 16645a0..b375385 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,23 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3 # +2006-10-04 01:32:57 GMT Michael Poole patch-52 + + Summary: + Fix some startup-related glitches. + Revision: + srvx--devo--1.3--patch-52 + + src/ioset.h (ioset_update): Declare new function. + + src/ioset.c (ioset_init): If we have an engine, return early. + (ioset_add): If no engine, try to initialize. + (ioset_update): New function. + + modified files: + ChangeLog src/ioset.c src/ioset.h + + 2006-10-04 01:23:10 GMT Michael Poole patch-51 Summary: diff --git a/src/ioset.c b/src/ioset.c index a66af6f..7220413 100644 --- a/src/ioset.c +++ b/src/ioset.c @@ -93,7 +93,8 @@ extern struct io_engine io_engine_select; void ioset_init(void) { - assert(engine == NULL); + if (engine) /* someone beat us to it */ + return; #if WITH_IOSET_KQUEUE if (!engine && io_engine_kqueue.init()) @@ -133,6 +134,8 @@ ioset_add(int fd) { log_module(MAIN_LOG, LOG_ERROR, "Somebody called ioset_add(%d) on a negative fd!", fd); return 0; } + if (!engine) + ioset_init(); res = calloc(1, sizeof(*res)); if (!res) return 0; @@ -269,6 +272,10 @@ ioset_connect(struct sockaddr *local, unsigned int sa_size, const char *peer, un return io_fd; } +void ioset_update(struct io_fd *fd) { + engine->update(fd); +} + static void ioset_try_write(struct io_fd *fd) { int res; diff --git a/src/ioset.h b/src/ioset.h index be27332..48e6924 100644 --- a/src/ioset.h +++ b/src/ioset.h @@ -52,6 +52,7 @@ void ioset_init(void); struct io_fd *ioset_add(int fd); struct io_fd *ioset_listen(struct sockaddr *local, unsigned int sa_size, void *data, void (*accept_cb)(struct io_fd *listener, struct io_fd *new_connect)); struct io_fd *ioset_connect(struct sockaddr *local, unsigned int sa_size, const char *hostname, unsigned int port, int blocking, void *data, void (*connect_cb)(struct io_fd *fd, int error)); +void ioset_update(struct io_fd *fd); void ioset_run(void); void ioset_write(struct io_fd *fd, const char *buf, unsigned int nbw); int ioset_printf(struct io_fd *fd, const char *fmt, ...) PRINTF_LIKE(2, 3); -- 2.20.1