From 39847c3701be03a34e1405c31404e9e7f7769516 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 8 Nov 2007 20:30:06 +0000 Subject: [PATCH] Minimal intervention fix for #162: we can delay arming a kevent, but we can't delay disarming it, or we will have a race between the acceptor and a worker thread. This will need revisiting at some later date. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2232 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_acceptor_kqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c index 800bc102..54631a3a 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c +++ b/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c @@ -66,8 +66,8 @@ vca_kq_sess(struct sess *sp, short arm) if (sp->fd < 0) return; EV_SET(&ki[nki], sp->fd, EVFILT_READ, arm, 0, 0, sp); - if (++nki == NKEV) { - assert(kevent(kq, ki, nki, NULL, 0, NULL) <= 0); + if (++nki == NKEV || arm == EV_DELETE) { + AZ(kevent(kq, ki, nki, NULL, 0, NULL)); nki = 0; } } -- 2.39.5