r4521 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Feb 1 14:25:03 CET 2010


Author: phk
Date: 2010-02-01 14:25:01 +0100 (Mon, 01 Feb 2010)
New Revision: 4521

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/bin/varnishd/cache_cli.c
Log:
When we detect the parent absconding the CLI pipes, close the acceptor
sockets as fast as we can, so that a new copy of varnishd can get at them.

Fixes	#622



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2010-02-01 13:06:31 UTC (rev 4520)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2010-02-01 13:25:01 UTC (rev 4521)
@@ -450,6 +450,7 @@
 void vca_close_session(struct sess *sp, const char *why);
 void VCA_Prep(struct sess *sp);
 void VCA_Init(void);
+void VCA_Shutdown(void);
 const char *VCA_waiter_name(void);
 extern pthread_t VCA_thread;
 

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2010-02-01 13:06:31 UTC (rev 4520)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2010-02-01 13:25:01 UTC (rev 4521)
@@ -425,6 +425,21 @@
 }
 
 void
+VCA_Shutdown(void)
+{
+	struct listen_sock *ls;
+	int i;
+
+	VTAILQ_FOREACH(ls, &heritage.socks, list) {
+		if (ls->sock < 0)
+			continue;
+		i = ls->sock;
+		ls->sock = -1;
+		(void)close(i);
+	}
+}
+
+void
 VCA_tweak_waiter(struct cli *cli, const char *arg)
 {
 	int i;

Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_cli.c	2010-02-01 13:06:31 UTC (rev 4520)
+++ trunk/varnish-cache/bin/varnishd/cache_cli.c	2010-02-01 13:25:01 UTC (rev 4521)
@@ -112,6 +112,7 @@
 		i = CLS_Poll(cls, -1);
 	} while(i > 0);
 	VSL(SLT_CLI, 0, "EOF on CLI connection, worker stops");
+	VCA_Shutdown();
 }
 
 /*--------------------------------------------------------------------*/



More information about the varnish-commit mailing list