From: Willy Tarreau Date: Sun, 13 May 2007 12:51:41 +0000 (+0200) Subject: Merge branch 'master' into timers X-Git-Tag: v1.3.11~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01ba1c909d861d7f07ebbbf386762dd6c40fd398;p=thirdparty%2Fhaproxy.git Merge branch 'master' into timers --- 01ba1c909d861d7f07ebbbf386762dd6c40fd398 diff --cc src/ev_sepoll.c index d2fcc7c7c2,de92c5d95b..516c0f592a --- a/src/ev_sepoll.c +++ b/src/ev_sepoll.c @@@ -235,34 -240,10 +240,10 @@@ REGPRM1 static void __fd_clo(int fd /* * speculative epoll() poller */ -REGPRM2 static void _do_poll(struct poller *p, int wait_time) +REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp) { static unsigned int last_skipped; - int status; + int status, eo; int fd, opcode; int count; int spec_idx; @@@ -369,18 -367,21 +368,27 @@@ tv_now(&now); return; } + } + last_skipped = 0; + + if (nbspec || status) { + /* Maybe we have processed some events that we must report, or + * maybe we still have events in the spec list, so we must not + * wait in epoll() otherwise we will delay their delivery by + * the next timeout. + */ wait_time = 0; } + else { + if (tv_isset(exp)) + wait_time = tv_ms_remain(&now, exp); + else + wait_time = -1; + } - last_skipped = 0; - /* now let's wait for events */ + /* now let's wait for real events */ status = epoll_wait(epoll_fd, epoll_events, maxfd, wait_time); + tv_now(&now); for (count = 0; count < status; count++) {