r961 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Sep 11 12:16:02 CEST 2006


Author: phk
Date: 2006-09-11 12:16:02 +0200 (Mon, 11 Sep 2006)
New Revision: 961

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
Log:
Only expire when the timer fires


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2006-09-11 10:14:45 UTC (rev 960)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c	2006-09-11 10:16:02 UTC (rev 961)
@@ -101,7 +101,7 @@
 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 @@
 
 	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 (;;) {




More information about the varnish-commit mailing list