From ee6d10eae3e517f500ecc60ac30bfc26a93eaf43 Mon Sep 17 00:00:00 2001 From: des Date: Tue, 17 Jul 2007 13:05:08 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1711 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/mgt_child.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index a82fce2a..75900d15 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -130,8 +130,10 @@ open_sockets(void) 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 @@ start_child(void) 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 @@ mgt_sigchld(struct ev *e, int what) 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); } -- 2.39.5