]> err.no Git - varnish/commitdiff
Amend previous commit. The problem was that when a socket was already open,
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jul 2007 13:05:08 +0000 (13:05 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jul 2007 13:05:08 +0000 (13:05 +0000)
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

index a82fce2a72412f93a92db8e16be22f4707ca8468..75900d15eb787035c9bd5e49d9eb76215c1c7703 100644 (file)
@@ -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);
 }