]> err.no Git - varnish/commitdiff
Fix child restart by always calling close_sockets() when the child dies;
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jul 2007 10:33:46 +0000 (10:33 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 17 Jul 2007 10:33:46 +0000 (10:33 +0000)
otherwise open_sockets() fails, which causes start_child() to fail silently.

Furthermore, if open_sockets() fails and child_state is CH_DIED, it will
not be possible to start it manually later; therefore, set child_state
to CH_STOPPED when open_sockets() fails.

Note: it wouldn't hurt if open_sockets() were a little more talkative.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1710 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/mgt_child.c

index 6445f7263e49a02dd850159ce25540d2392007cf..a82fce2a72412f93a92db8e16be22f4707ca8468 100644 (file)
@@ -174,8 +174,10 @@ start_child(void)
        if (child_state != CH_STOPPED && child_state != CH_DIED)
                return;
 
-       if (open_sockets())
+       if (open_sockets()) {
+               child_state = CH_STOPPED;
                return; /* XXX ?? */
+       }
 
        child_state = CH_STARTING;
 
@@ -336,12 +338,11 @@ 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) {
-               close_sockets();
+       else if (child_state == CH_DIED)
                child_state = CH_STOPPED;
-       }
        else if (child_state == CH_STOPPING)
                child_state = CH_STOPPED;
        return (0);