aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--src/listen.c28
2 files changed, 26 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 1ba01763e..b42918676 100644
--- a/NEWS
+++ b/NEWS
@@ -68,6 +68,7 @@ ver 0.15 (200?/??/??)
* pause when all audio outputs fail to play
* daemon: ignore "user" setting if already running as that user
* listen: fix broken client IP addresses in log
+* listen: bind failure on secondary address is non-fatal
* 24/32 bit audio support
* print available protocols in --version
* fill buffer after seeking
diff --git a/src/listen.c b/src/listen.c
index 173ec762d..98108d9da 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -247,10 +247,32 @@ listen_add_host(const char *hostname, unsigned port, GError **error_r)
}
for (i = ai; i != NULL; i = i->ai_next) {
+ GError *error = NULL;
+
success = listen_add_address(i->ai_family, i->ai_addr,
- i->ai_addrlen, error_r);
- if (!success)
- return false;
+ i->ai_addrlen, &error);
+ if (!success) {
+ if (i == ai) {
+ /* first bind has failed: fatal
+ error */
+ g_propagate_error(error_r, error);
+ return false;
+ } else {
+ char *address_string =
+ sockaddr_to_string(i->ai_addr,
+ i->ai_addrlen,
+ NULL);
+ if (address_string == NULL)
+ address_string = g_strdup("[unknown]");
+
+ g_warning("bind to %s failed: %s "
+ "(continuing anyway, because at "
+ "least one address is bound)",
+ address_string, error->message);
+ g_free(address_string);
+ g_error_free(error);
+ }
+ }
}
freeaddrinfo(ai);