]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
mdns: avahi: set AVAHI_CLIENT_NO_FAIL in avahi_client_new()
authorJörg Krause <joerg.krause@embedded.rocks>
Thu, 24 Nov 2016 11:34:11 +0000 (12:34 +0100)
committerJörg Krause <joerg.krause@embedded.rocks>
Thu, 24 Nov 2016 13:46:59 +0000 (14:46 +0100)
For whatever reasons `avahi_client_new` passes the value `0` as its
second parameter. However, the second parameter is of type
[`AvahiClientFlags`](http://avahi.org/doxygen/html/client_8h_source.html#l00048)
with the possible values:

``` c
typedef enum {
    AVAHI_CLIENT_IGNORE_USER_CONFIG = 1,
    AVAHI_CLIENT_NO_FAIL = 2
} AvahiClientFlags;
```

Setting `AVAHI_CLIENT_NO_FAIL` has the benefit that the shairport-sync
daemon does not depend on the order of the init process whether the
avahi daemon is already up.

mdns_avahi.c

index 12df05057fe4d42d919363594032c39d91827051..7fe6c1874252b43fae32d536b9585ec2cf937b97 100644 (file)
@@ -273,7 +273,7 @@ static int avahi_register(char *srvname, int srvport) {
     return -1;
   }
   if (!(client =
-            avahi_client_new(avahi_threaded_poll_get(tpoll), 0, client_callback, NULL, &err))) {
+            avahi_client_new(avahi_threaded_poll_get(tpoll), AVAHI_CLIENT_NO_FAIL, client_callback, NULL, &err))) {
     warn("couldn't create avahi client: %s!", avahi_strerror(err));
     return -1;
   }