[avahi] Using Avahi w/ libevent

Philip Prindeville philipp_subx at redfish-solutions.com
Sat Jun 23 04:23:05 UTC 2018


I had sent a message on IRC asking about using Avahi (writ large) with libevent, and Trent responded, suggesting I take a look at either the glib-watch code, or else the libevent glue here:


and that was actually good advise.  I did a quick rewrite (in progress, needs headers, etc) here:


which I’ll eventually be turning into a PR.

But after doing that, I went back to look at the part of Avahi I wanted to use: avahi-compat-libdns_sd/compat.c and in particular, calling DNSServiceRegister()… alas, the polling is hard-coded:

    if (!(sdref->client = avahi_client_new(avahi_simple_poll_get(sdref->simple_poll), 0, reg_client_callback, sdref, &error))) {
        ret =  map_error(error);
        goto finish;

so the time spent on writing the libevent glue for Avahi might have been in vain, unless I can figure out another way to send mDNS announcements (i.e. service registrations) from a libevent-centric program without too much trouble.

Anyone have suggestions on how to do this?



More information about the avahi mailing list