From 81f318e12f915864c700c45a0f21ab1fdc6c2fcc Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 11 Sep 2006 10:16:02 +0000 Subject: [PATCH] Only expire when the timer fires git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@961 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_acceptor_kqueue.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c index fbf20f5d..3827a060 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c +++ b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c @@ -101,7 +101,7 @@ static void * vca_kqueue_main(void *arg) { struct kevent ke[NKEV], *kp; - int j, n; + int j, n, dotimer; struct timespec ts; struct sess *sp; @@ -117,15 +117,20 @@ vca_kqueue_main(void *arg) nki = 0; while (1) { + dotimer = 0; n = kevent(kq, ki, nki, ke, NKEV, NULL); assert(n >= 1 && n <= NKEV); nki = 0; for (kp = ke, j = 0; j < n; j++, kp++) { - if (kp->filter == EVFILT_TIMER) + if (kp->filter == EVFILT_TIMER) { + dotimer = 1; continue; + } assert(kp->filter == EVFILT_READ); vca_kev(kp); } + if (!dotimer) + continue; clock_gettime(CLOCK_REALTIME, &ts); ts.tv_sec -= params->sess_timeout; for (;;) { -- 2.39.5