r1889 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Aug 20 13:05:48 CEST 2007


Author: phk
Date: 2007-08-20 13:05:48 +0200 (Mon, 20 Aug 2007)
New Revision: 1889

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_backend.c
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
Log:
Remove the unnecessary third argument to VBE_ClosedFd() and remove
a couple of now pointless debugging messages in pipe mode.


Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2007-08-20 11:05:07 UTC (rev 1888)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2007-08-20 11:05:48 UTC (rev 1889)
@@ -366,7 +366,7 @@
 /* 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);

Modified: trunk/varnish-cache/bin/varnishd/cache_backend.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_backend.c	2007-08-20 11:05:07 UTC (rev 1888)
+++ trunk/varnish-cache/bin/varnishd/cache_backend.c	2007-08-20 11:05:48 UTC (rev 1889)
@@ -290,7 +290,7 @@
 			reuse = 1;
 			break;
 		}
-		VBE_ClosedFd(sp->wrk, vc, 0);
+		VBE_ClosedFd(sp->wrk, vc);
 	}
 
 	if (vc == NULL) {
@@ -352,15 +352,14 @@
 /* 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);

Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2007-08-20 11:05:07 UTC (rev 1888)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2007-08-20 11:05:48 UTC (rev 1889)
@@ -346,7 +346,7 @@
 			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 @@
 		cls = 1;
 
 	if (cls)
-		VBE_ClosedFd(sp->wrk, vc, 0);
+		VBE_ClosedFd(sp->wrk, vc);
 	else
 		VBE_RecycleFd(sp->wrk, vc);
 

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2007-08-20 11:05:07 UTC (rev 1888)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2007-08-20 11:05:48 UTC (rev 1889)
@@ -50,8 +50,6 @@
 
 	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 @@
 	}
 	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 @@
 
 	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 @@
 			rdf(fds, 1);
 	}
 	vca_close_session(sp, "pipe");
-	(void)close (vc->fd);
-	VBE_ClosedFd(sp->wrk, vc, 1);
+	VBE_ClosedFd(sp->wrk, vc);
 }




More information about the varnish-commit mailing list