From: des Date: Thu, 8 Nov 2007 20:30:06 +0000 (+0000) Subject: Minimal intervention fix for #162: we can delay arming a kevent, but we X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39847c3701be03a34e1405c31404e9e7f7769516;p=varnish 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 --- 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; } }