r1711 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Tue Jul 17 15:05:08 CEST 2007


Author: des
Date: 2007-07-17 15:05:08 +0200 (Tue, 17 Jul 2007)
New Revision: 1711

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_child.c
Log:
Amend previous commit.  The problem was that when a socket was already open,
open_sockets() did not count it as "good".  Having fixed this, revert to the
previous behaviour of keeping the sockets open if auto_restart is on; this
avoids having a brief window (until they are reopened) during which client
connections are refused.


Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c	2007-07-17 10:33:46 UTC (rev 1710)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c	2007-07-17 13:05:08 UTC (rev 1711)
@@ -130,8 +130,10 @@
 	int good = 0;
 
 	TAILQ_FOREACH_SAFE(ls, &heritage.socks, list, ls2) {
-		if (ls->sock >= 0)
+		if (ls->sock >= 0) {
+			good++;
 			continue;
+		}
 		ls->sock = VSS_listen(ls->addr, params->listen_depth);
 		if (ls->sock < 0) {
 			TAILQ_REMOVE(&heritage.socks, ls, list);
@@ -174,7 +176,7 @@
 	if (child_state != CH_STOPPED && child_state != CH_DIED)
 		return;
 
-	if (open_sockets()) {
+	if (open_sockets() != 0) {
 		child_state = CH_STOPPED;
 		return;	/* XXX ?? */
 	}
@@ -338,12 +340,12 @@
 	child_fds[0] = -1;
 	fprintf(stderr, "Child cleaned\n");
 
-	close_sockets();
 	if (child_state == CH_DIED && params->auto_restart)
 		start_child();
-	else if (child_state == CH_DIED)
+	else if (child_state == CH_DIED) {
+		close_sockets();
 		child_state = CH_STOPPED;
-	else if (child_state == CH_STOPPING)
+	} else if (child_state == CH_STOPPING)
 		child_state = CH_STOPPED;
 	return (0);
 }




More information about the varnish-commit mailing list