X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Feventl.c;h=1446da5f82d468479163f193c33dc8450a972bf1;hb=62d0f3042e380b729b560c653a5dc96978df7c78;hp=77745b62c3369fa7c330b947ead0fdadd0af0546;hpb=a6554f8586863ffa7a4c5c90b5ac636cd4ffbe73;p=pazpar2-moved-to-github.git diff --git a/src/eventl.c b/src/eventl.c index 77745b6..1446da5 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -245,16 +245,18 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) { { fds[i].fd = man->sel_fd; fds[i].input_mask = yaz_poll_read; + fds[i].client_data = 0; i++; } for (p = start; p; p = p->next, i++) { + fds[i].client_data = p; + fds[i].fd = p->fd; + fds[i].input_mask = 0; if (p->thread_users > 0) continue; if (p->max_idle && p->max_idle < to.tv_sec) to.tv_sec = p->max_idle; - fds[i].fd = p->fd; - fds[i].input_mask = 0; if (p->fd < 0) continue; if (p->flags & EVENT_INPUT) @@ -302,9 +304,10 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) { no++; yaz_log(man->log_level, "%d channels", no); } - for (p = start; p; p = p->next, i++) + for (; i < no_fds; i++) { time_t now = time(0); + p = fds[i].client_data; if (p->destroyed) { @@ -321,15 +324,13 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) { continue; } p->this_event = 0; - if (p->max_idle && now - p->last_event > p->max_idle) { p->last_event = now; p->this_event |= EVENT_TIMEOUT; } - if (p->fd >= 0) + if (fds[i].fd >= 0) { - assert(fds[i].fd == p->fd); if (fds[i].output_mask & yaz_poll_read) { p->last_event = now;