[avahi] avahi_client_new with AvahiGLibPoll blocks for some seconds if avahi-daemon is not running

Lars Hanisch dvb at flensrocker.de
Sat Apr 20 03:38:49 PDT 2013


Hi,

 I'm using Ubuntu 12.04, avahi is version 0.6.30-5ubuntu2, GLib is 2.32.3.

 My program (actually the plugin avahi4vdr[1] for vdr[2]) uses a GMainLoop with own GMainContext pushed as default
thread context, and avahi_glib_poll_new is used with this context (see [3]). If the avahi-daemon is not running the call
of avahi_client_new blocks for some seconds and syslog messages are indicating, that libavahi-client seems to try to
start the avahi-daemon via dbus activation.

dbus[683]: [system] Failed to activate service 'org.freedesktop.Avahi': timed out

 Since I want to handle reconnects on avahi-daemon stop/starts I quit the GMainLoop on AVAHI_CLIENT_FAILURE and enter a
loop which try to reconnect with avahi_client_new. This worked fine as long as I used AvahiSimplePoll, but due to
threading issues I have to switch to AvahiGLibPoll.
 Even if I call avahi_client_new with AVAHI_CLIENT_NO_FAIL I have this latency of some seconds.

 Is it possible to configure AvahiGLibPoll so that it's not trying to use dbus activation so that my program gets more
responsive again?

 Thanks!

Regards,
Lars.

[1] https://github.com/flensrocker/vdr-plugin-avahi4vdr
[2] http://www.tvdr.de/
[3] https://github.com/flensrocker/vdr-plugin-avahi4vdr/blob/master/avahi-client.c#L189


More information about the avahi mailing list