X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Feventl.c;h=40f7a69826d0223ef7660647898e8adced8bf732;hb=4193aa864cbf4f36d264179f9be1999ce74e77e6;hp=d8d3536b51b52dc55afff35b48c092ad846ea27c;hpb=f426057b0d32e25f0799372dfd4ea382591aa917;p=pazpar2-moved-to-github.git diff --git a/src/eventl.c b/src/eventl.c index d8d3536..40f7a69 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -78,8 +78,17 @@ void iochan_man_destroy(iochan_man_t *mp) { if (*mp) { + IOCHAN c; if ((*mp)->sel_thread) sel_thread_destroy((*mp)->sel_thread); + + c = (*mp)->channel_list; + while (c) + { + IOCHAN c_next = c->next; + xfree(c); + c = c_next; + } xfree(*mp); *mp = 0; } @@ -155,7 +164,7 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) FD_ZERO(&out); FD_ZERO(&except); timeout = &to; /* hang on select */ - to.tv_sec = 15; + to.tv_sec = 300; to.tv_usec = 0; max = 0; for (p = *iochans; p; p = p->next) @@ -166,6 +175,8 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) p->flags = (*p->maskfun)(p); if (p->socketfun) p->fd = (*p->socketfun)(p); + if (p->max_idle && p->max_idle < to.tv_sec) + to.tv_sec = p->max_idle; if (p->fd < 0) continue; if (p->force_event) @@ -178,8 +189,6 @@ static int event_loop(iochan_man_t man, IOCHAN *iochans) FD_SET(p->fd, &except); if (p->fd > max) max = p->fd; - if (p->max_idle && p->max_idle < to.tv_sec) - to.tv_sec = p->max_idle; } if (man->sel_fd != -1) {