Fix Avahi mDNS backend

Fix Avahi polling:
 - use avahi_simple_poll_loop() in rend-avahi.c:rend_poll() instead
   of reinventing yet another type of wheel;
 - start RendezVous thread after daemonizing, so the thread actually
   runs after we've daemonized.

Also handle Avahi daemon restarts, as it's good practice and easy to do.

 ... And /that/, my friends, is how we do that ...
This commit is contained in:
Julien BLACHE
2009-04-02 13:22:23 +02:00
parent 464bd414a1
commit 1b98e3c036
2 changed files with 40 additions and 17 deletions

View File

@@ -469,6 +469,12 @@ int main(int argc, char *argv[]) {
runas = conf_alloc_string("general","runas","nobody");
if(!os_init(config.foreground,runas)) {
DPRINTF(E_LOG,L_MAIN,"Could not initialize server\n");
os_deinit();
exit(EXIT_FAILURE);
}
if(config.use_mdns) {
DPRINTF(E_LOG,L_MAIN,"Starting rendezvous daemon\n");
if(rend_init(runas)) {
@@ -477,12 +483,6 @@ int main(int argc, char *argv[]) {
}
}
if(!os_init(config.foreground,runas)) {
DPRINTF(E_LOG,L_MAIN,"Could not initialize server\n");
os_deinit();
exit(EXIT_FAILURE);
}
free(runas);
#ifdef UPNP