[avahi] Using Avahi w/ libevent
Philip Prindeville
philipp_subx at redfish-solutions.com
Sat Jun 23 04:23:05 UTC 2018
Hi.
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:
https://raw.githubusercontent.com/ejurgensen/forked-daapd/master/src/mdns_avahi.c
and that was actually good advise. I did a quick rewrite (in progress, needs headers, etc) here:
https://github.com/pprindeville/avahi/commit/8d5441deb04ba4a38be0b4ffe5c0500987cf4431
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?
Thanks,
-Philip
More information about the avahi
mailing list