]> err.no Git - varnish/commitdiff
Close gracefully in pipe mode
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 7 Jul 2006 08:40:03 +0000 (08:40 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 7 Jul 2006 08:40:03 +0000 (08:40 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@374 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_pipe.c

index 932e6b197ffc8a7afeab6e3619a3c37b6b1e1668..f8e7fc67fcc7723143b251eaae4dca9ba67715c2 100644 (file)
@@ -37,7 +37,11 @@ rdf(int fd, short event, void *arg)
                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 @@ PipeSession(struct worker *w, struct sess *sp)
        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;