r5082 - trunk/varnish-cache/bin/varnishd

phk at varnish-cache.org phk at varnish-cache.org
Tue Aug 10 11:40:18 CEST 2010


Author: phk
Date: 2010-08-10 11:40:18 +0200 (Tue, 10 Aug 2010)
New Revision: 5082

Modified:
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Fix a corner-case of pipe mode close-down processing, by simplifying
the logic and letting vca_close_session() and VBE_CloseFd() carry out
the last rites.

Closes: #746




Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2010-08-10 09:23:39 UTC (rev 5081)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2010-08-10 09:40:18 UTC (rev 5082)
@@ -114,26 +114,22 @@
 		if (i < 1)
 			break;
 		if (fds[0].revents && rdf(vc->fd, sp->fd)) {
+			if (fds[1].fd == -1)
+				break;
 			(void)shutdown(vc->fd, SHUT_RD);
 			(void)shutdown(sp->fd, SHUT_WR);
 			fds[0].events = 0;
 			fds[0].fd = -1;
 		}
 		if (fds[1].revents && rdf(sp->fd, vc->fd)) {
+			if (fds[0].fd == -1)
+				break;
 			(void)shutdown(sp->fd, SHUT_RD);
 			(void)shutdown(vc->fd, SHUT_WR);
 			fds[1].events = 0;
 			fds[1].fd = -1;
 		}
 	}
-	if (fds[0].fd >= 0) {
-		(void)shutdown(vc->fd, SHUT_RD);
-		(void)shutdown(sp->fd, SHUT_WR);
-	}
-	if (fds[1].fd >= 0) {
-		(void)shutdown(sp->fd, SHUT_RD);
-		(void)shutdown(vc->fd, SHUT_WR);
-	}
 	vca_close_session(sp, "pipe");
 	VBE_CloseFd(sp);
 }




More information about the varnish-commit mailing list