r4047 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish

phk at projects.linpro.no phk at projects.linpro.no
Mon May 4 09:43:17 CEST 2009


Author: phk
Date: 2009-05-04 09:43:16 +0200 (Mon, 04 May 2009)
New Revision: 4047

Modified:
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
   trunk/varnish-cache/include/libvarnish.h
   trunk/varnish-cache/lib/libvarnish/tcp.c
Log:
r4046 forgot to reset SO_LINGER for pipe handling which basically
broke pipehandling.

Fixes #505



Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2009-05-01 10:34:12 UTC (rev 4046)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2009-05-04 07:43:16 UTC (rev 4047)
@@ -247,8 +247,7 @@
 		 * This is an orderly close of the connection; ditch linger 
 		 * before we close, to get queued data transmitted.
 		 */
-		struct linger lin = { 0, 0 };
-		AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &lin, sizeof lin));
+		TCP_linger(sp->fd, 0);
 		vca_close_session(sp, sp->doclose);
 	}
 	if (sp->fd < 0) {

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2009-05-01 10:34:12 UTC (rev 4046)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2009-05-04 07:43:16 UTC (rev 4047)
@@ -98,8 +98,12 @@
 	sp->t_resp = TIM_real();
 
 	memset(fds, 0, sizeof fds);
+
+	TCP_linger(vc->fd, 0);
 	fds[0].fd = vc->fd;
 	fds[0].events = POLLIN | POLLERR;
+
+	TCP_linger(sp->fd, 0);
 	fds[1].fd = sp->fd;
 	fds[1].events = POLLIN | POLLERR;
 

Modified: trunk/varnish-cache/include/libvarnish.h
===================================================================
--- trunk/varnish-cache/include/libvarnish.h	2009-05-01 10:34:12 UTC (rev 4046)
+++ trunk/varnish-cache/include/libvarnish.h	2009-05-04 07:43:16 UTC (rev 4047)
@@ -61,6 +61,7 @@
 int TCP_filter_http(int sock);
 void TCP_blocking(int sock);
 void TCP_nonblocking(int sock);
+void TCP_linger(int sock, int linger);
 #ifdef SOL_SOCKET
 void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf,
     unsigned alen, char *pbuf, unsigned plen);

Modified: trunk/varnish-cache/lib/libvarnish/tcp.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/tcp.c	2009-05-01 10:34:12 UTC (rev 4046)
+++ trunk/varnish-cache/lib/libvarnish/tcp.c	2009-05-04 07:43:16 UTC (rev 4047)
@@ -222,3 +222,17 @@
 	AZ(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout));
 #endif
 }
+
+/*--------------------------------------------------------------------
+ * Set or reset SO_LINGER flag
+ */
+ 
+void
+TCP_linger(int sock, int linger)
+{
+	struct linger lin;
+
+	memset(&lin, 0, sizeof lin);
+	lin.l_onoff = linger;
+	AZ(setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin));
+}



More information about the varnish-commit mailing list