r923 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Wed Sep 6 20:23:24 CEST 2006


Author: phk
Date: 2006-09-06 20:23:24 +0200 (Wed, 06 Sep 2006)
New Revision: 923

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c
Log:
Fix the poll acceptor, we need to cache the fd as sp->fd might
change to -1 under us.


Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2006-09-06 11:21:40 UTC (rev 922)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor_poll.c	2006-09-06 18:23:24 UTC (rev 923)
@@ -78,7 +78,7 @@
 	unsigned v;
 	struct sess *sp, *sp2;
 	struct timespec ts;
-	int i;
+	int i, fd;
 
 	(void)arg;
 
@@ -100,13 +100,14 @@
 			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 @@
 			    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);
 		}




More information about the varnish-commit mailing list