Commit 865004db authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

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: http://www.varnish-cache.org/svn/trunk/varnish-cache@1711 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 12a5fa56
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment