]> err.no Git - varnish/commitdiff
Discard any listen sockets that fail to bind().
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Jun 2007 10:22:44 +0000 (10:22 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Jun 2007 10:22:44 +0000 (10:22 +0000)
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

index a11e0bef0812c0c2884c2b045e276990a59cd475..70a34aef4c9ea5580db329b7bada8d5252eb4d3d 100644 (file)
@@ -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);
 }