Mailing List Archive

r1559 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2007-06-25 12:22:44 +0200 (Mon, 25 Jun 2007)
New Revision: 1559

Modified:
trunk/varnish-cache/bin/varnishd/mgt_child.c
Log:
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.



Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_child.c 2007-06-25 09:46:30 UTC (rev 1558)
+++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2007-06-25 10:22:44 UTC (rev 1559)
@@ -126,16 +126,23 @@
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);
}