From: phk Date: Wed, 6 Sep 2006 18:23:24 +0000 (+0000) Subject: Fix the poll acceptor, we need to cache the fd as sp->fd might X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ac04bcc414209706776cd3e56d2a38495a0afef;p=varnish Fix the poll acceptor, we need to cache the fd as sp->fd might change to -1 under us. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@923 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_acceptor_poll.c b/varnish-cache/bin/varnishd/cache_acceptor_poll.c index d0dcd7a8..8dfea586 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor_poll.c +++ b/varnish-cache/bin/varnishd/cache_acceptor_poll.c @@ -78,7 +78,7 @@ vca_main(void *arg) unsigned v; struct sess *sp, *sp2; struct timespec ts; - int i; + int i, fd; (void)arg; @@ -100,13 +100,14 @@ vca_main(void *arg) if (v == 0) break; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - if (pollfd[sp->fd].revents) { + fd = sp->fd; + if (pollfd[fd].revents) { v--; i = vca_pollsession(sp); if (i < 0) continue; TAILQ_REMOVE(&sesshead, sp, list); - vca_unpoll(sp->fd); + vca_unpoll(fd); if (i == 0) vca_handover(sp, i); else @@ -119,7 +120,7 @@ vca_main(void *arg) sp->t_open.tv_nsec > ts.tv_nsec) continue; TAILQ_REMOVE(&sesshead, sp, list); - vca_unpoll(sp->fd); + vca_unpoll(fd); vca_close_session(sp, "timeout"); SES_Delete(sp); }