From 9d8622e60211cf951ba23673605e939b18b59fde Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 25 Jun 2007 10:22:44 +0000 Subject: [PATCH] Discard any listen sockets that fail to bind(). This can happen if you get an IPv6 address for the -a argument, but runs without IPv6 enabled in your kernel. Typically happens only for localhost. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1559 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/mgt_child.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index a11e0bef..70a34aef 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -126,16 +126,23 @@ child_poker(struct ev *e, int what) static int open_sockets(void) { - struct listen_sock *ls; + struct listen_sock *ls, *ls2; + int good = 0; - TAILQ_FOREACH(ls, &heritage.socks, list) { + TAILQ_FOREACH_SAFE(ls, &heritage.socks, list, ls2) { if (ls->sock >= 0) continue; ls->sock = VSS_listen(ls->addr, params->listen_depth); + if (ls->sock < 0) { + TAILQ_REMOVE(&heritage.socks, ls, list); + free(ls); + continue; + } TCP_filter_http(ls->sock); - if (ls->sock < 0) - return (1); + good++; } + if (!good) + return (1); return (0); } -- 2.39.5