From 87720d040a3ff10c2b577a2f5c11ec325badf418 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 7 Jul 2006 08:40:03 +0000 Subject: [PATCH] Close gracefully in pipe mode git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@374 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_pipe.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index 932e6b19..f8e7fc67 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -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; -- 2.39.5