From 3d06973a92df03a54f87f7f1cce2c6a4fc46fcbe Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 20 Aug 2007 11:05:48 +0000 Subject: [PATCH] Remove the unnecessary third argument to VBE_ClosedFd() and remove a couple of now pointless debugging messages in pipe mode. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1889 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_backend.c | 7 +++---- varnish-cache/bin/varnishd/cache_fetch.c | 4 ++-- varnish-cache/bin/varnishd/cache_pipe.c | 11 +++-------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 7cad55d5..19160ebc 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -366,7 +366,7 @@ extern int vca_pipes[2]; /* cache_backend.c */ void VBE_Init(void); struct vbe_conn *VBE_GetFd(struct sess *sp); -void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc, int already); +void VBE_ClosedFd(struct worker *w, struct vbe_conn *vc); void VBE_RecycleFd(struct worker *w, struct vbe_conn *vc); struct bereq * VBE_new_bereq(void); void VBE_free_bereq(struct bereq *bereq); diff --git a/varnish-cache/bin/varnishd/cache_backend.c b/varnish-cache/bin/varnishd/cache_backend.c index 744940aa..2e46b6e1 100644 --- a/varnish-cache/bin/varnishd/cache_backend.c +++ b/varnish-cache/bin/varnishd/cache_backend.c @@ -290,7 +290,7 @@ vbe_nextfd(struct sess *sp) reuse = 1; break; } - VBE_ClosedFd(sp->wrk, vc, 0); + VBE_ClosedFd(sp->wrk, vc); } if (vc == NULL) { @@ -352,15 +352,14 @@ VBE_GetFd(struct sess *sp) /* Close a connection ------------------------------------------------*/ void -VBE_ClosedFd(struct worker *w, struct vbe_conn *vc, int already) +VBE_ClosedFd(struct worker *w, struct vbe_conn *vc) { CHECK_OBJ_NOTNULL(vc, VBE_CONN_MAGIC); assert(vc->fd >= 0); AN(vc->backend); WSL(w, SLT_BackendClose, vc->fd, "%s", vc->backend->vcl_name); - if (!already) - AZ(close(vc->fd)); + AZ(close(vc->fd)); vc->fd = -1; vc->backend = NULL; LOCK(&vbemtx); diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index c34d82ac..02aa60c9 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -346,7 +346,7 @@ Fetch(struct sess *sp) TAILQ_REMOVE(&sp->obj->store, st, list); STV_free(st); } - VBE_ClosedFd(sp->wrk, vc, 0); + VBE_ClosedFd(sp->wrk, vc); return (-1); } @@ -364,7 +364,7 @@ Fetch(struct sess *sp) cls = 1; if (cls) - VBE_ClosedFd(sp->wrk, vc, 0); + VBE_ClosedFd(sp->wrk, vc); else VBE_RecycleFd(sp->wrk, vc); diff --git a/varnish-cache/bin/varnishd/cache_pipe.c b/varnish-cache/bin/varnishd/cache_pipe.c index d73b96f1..c33e5b3f 100644 --- a/varnish-cache/bin/varnishd/cache_pipe.c +++ b/varnish-cache/bin/varnishd/cache_pipe.c @@ -50,8 +50,6 @@ rdf(struct pollfd *fds, int idx) i = read(fds[idx].fd, buf, sizeof buf); if (i <= 0 || fds[1-idx].events == 0) { - VSL(SLT_Debug, fds[idx].fd, "Pipe Shut read(read)"); - VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut write(read)"); shutdown(fds[idx].fd, SHUT_RD); shutdown(fds[1-idx].fd, SHUT_WR); fds[idx].events = 0; @@ -59,9 +57,7 @@ rdf(struct pollfd *fds, int idx) } for (p = buf; i > 0; i -= j, p += j) { j = write(fds[1-idx].fd, p, i); - if (j < 0) { - VSL(SLT_Debug, fds[idx].fd, "Pipe Shut write(write)"); - VSL(SLT_Debug, fds[1-idx].fd, "Pipe Shut read(write)"); + if (j != i) { shutdown(fds[idx].fd, SHUT_WR); shutdown(fds[1-idx].fd, SHUT_RD); fds[1-idx].events = 0; @@ -98,7 +94,7 @@ PipeSession(struct sess *sp) if (WRK_Flush(w)) { vca_close_session(sp, "pipe"); - VBE_ClosedFd(sp->wrk, vc, 0); + VBE_ClosedFd(sp->wrk, vc); return; } @@ -125,6 +121,5 @@ PipeSession(struct sess *sp) rdf(fds, 1); } vca_close_session(sp, "pipe"); - (void)close (vc->fd); - VBE_ClosedFd(sp->wrk, vc, 1); + VBE_ClosedFd(sp->wrk, vc); } -- 2.39.5