r374 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jul 7 10:40:03 CEST 2006


Author: phk
Date: 2006-07-07 10:40:03 +0200 (Fri, 07 Jul 2006)
New Revision: 374

Modified:
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Close gracefully in pipe mode


Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-07-07 07:48:49 UTC (rev 373)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-07-07 08:40:03 UTC (rev 374)
@@ -37,7 +37,11 @@
 		event_del(&ep->ev);
 	} else {
 		j = write(ep->fd, buf, i);
-		assert(i == j);
+		if (i != j) {
+			shutdown(fd, SHUT_WR);
+			shutdown(ep->fd, SHUT_RD);
+			event_del(&ep->ev);
+		}
 	}
 }
 
@@ -57,7 +61,11 @@
 	assert(i == sbuf_len(w->sb));
 	if (http_GetTail(sp->http, 99999999, &b, &e) && b != e) { /* XXX */
 		i = write(fd, b, e - b);
-		assert(i == e - b);
+		if (i != e - b) {
+			close (fd);
+			vca_close_session(sp, "pipe");
+			VBE_ClosedFd(fd_token);
+		}
 	}
 
 	e1.fd = fd;




More information about the varnish-commit mailing list