From 944037cb95ef7a0eed6502fdea7541f2431b55cc Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 23 Feb 2010 12:17:49 +0100 Subject: [PATCH] Honor max_idle for non-fd IOCHANs Timeout specs for IOCHANs with non-fds (= -1) were not considered and thus the real timeout was longer than specified (15 seconds). We now use them and wait up to 300 seconds instead. --- src/eventl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/eventl.c b/src/eventl.c index d8d3536..3eff731 100644 --- a/src/eventl.c +++ b/src/eventl.c @@ -155,7 +155,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 +166,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 +180,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) { -- 1.7.10.4