From: Adam Dickmeiss Date: Wed, 13 Aug 2014 12:23:13 +0000 (+0200) Subject: Use IOCHAN for poll result inspection X-Git-Tag: v1.7.1~3^2 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=19b85891163749971c8e15f9ccca76cc4c5bb9bc;p=pazpar2-moved-to-github.git Use IOCHAN for poll result inspection --- 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;