From 19b85891163749971c8e15f9ccca76cc4c5bb9bc Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 13 Aug 2014 14:23:13 +0200 Subject: [PATCH] Use IOCHAN for poll result inspection --- src/eventl.c | 8 ++++---- src/eventl.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/eventl.c b/src/eventl.c index 148ddd7..b914bf3 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -253,6 +253,7 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) } for (p = start; p; p = p->next, i++) { + p->poll_offset = i; fds[i].client_data = p; fds[i].fd = p->fd; fds[i].input_mask = 0; @@ -282,9 +283,9 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) return 0; } } - i = 0; if (man->sel_fd != -1) { + i = 0; assert(fds[i].fd == man->sel_fd); if (fds[i].output_mask) { @@ -300,7 +301,6 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) chan->thread_users--; } } - i++; } if (man->log_level) { @@ -309,10 +309,10 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) no++; yaz_log(man->log_level, "%d channels", no); } - for (; i < no_fds; i++) + for (p = start; p; p = p->next) { time_t now = time(0); - p = fds[i].client_data; + i = p->poll_offset; if (p->destroyed) { diff --git a/src/eventl.h b/src/eventl.h index b320078..92f9a53 100644 --- a/src/eventl.h +++ b/src/eventl.h @@ -47,6 +47,7 @@ typedef struct iochan iochan_man_t man; char *name; struct iochan *next; + int poll_offset; } *IOCHAN; -- 1.7.10.4