diff options
author | Max Kellermann <max@duempel.org> | 2013-10-18 09:16:55 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-18 09:16:55 +0200 |
commit | d1c401fe7a637cdea728c8c2860d47c3d1e0efa0 (patch) | |
tree | d8a871d252acdca07dd98fee6ee5edb9f150ad43 /src/ZeroconfAvahi.cxx | |
parent | 964aa42b0479efac9a811ff071f27f28a27a6ede (diff) | |
download | mpd-d1c401fe7a637cdea728c8c2860d47c3d1e0efa0.tar.gz mpd-d1c401fe7a637cdea728c8c2860d47c3d1e0efa0.tar.xz mpd-d1c401fe7a637cdea728c8c2860d47c3d1e0efa0.zip |
ZeroconfAvahi: integrate into the EventLoop
Finally fixes the regression by commit c1f4f1fd.
Diffstat (limited to '')
-rw-r--r-- | src/ZeroconfAvahi.cxx | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/ZeroconfAvahi.cxx b/src/ZeroconfAvahi.cxx index 9714b13b1..dfdc7d8ec 100644 --- a/src/ZeroconfAvahi.cxx +++ b/src/ZeroconfAvahi.cxx @@ -19,33 +19,29 @@ #include "config.h" #include "ZeroconfAvahi.hxx" +#include "AvahiPoll.hxx" #include "ZeroconfInternal.hxx" #include "Listen.hxx" -#include "event/Loop.hxx" #include "system/FatalError.hxx" #include "util/Domain.hxx" #include "Log.hxx" -#include <glib.h> - #include <avahi-client/client.h> #include <avahi-client/publish.h> +#include <avahi-common/watch.h> #include <avahi-common/alternative.h> #include <avahi-common/domain.h> #include <avahi-common/malloc.h> #include <avahi-common/error.h> -#include <avahi-glib/glib-watch.h> +#include <stddef.h> static constexpr Domain avahi_domain("avahi"); static char *avahiName; static int avahiRunning; -#ifndef USE_EPOLL -static AvahiGLibPoll *avahi_glib_poll; -#endif -static const AvahiPoll *avahi_poll; +static MyAvahiPoll *avahi_poll; static AvahiClient *avahiClient; static AvahiEntryGroup *avahiGroup; @@ -246,15 +242,7 @@ AvahiInit(EventLoop &loop, const char *serviceName) avahiRunning = 1; -#ifdef USE_EPOLL - // TODO - (void)loop; - if (1==1) return; -#else - avahi_glib_poll = avahi_glib_poll_new(loop.GetContext(), - G_PRIORITY_DEFAULT); - avahi_poll = avahi_glib_poll_get(avahi_glib_poll); -#endif + avahi_poll = new MyAvahiPoll(loop); int error; avahiClient = avahi_client_new(avahi_poll, AVAHI_CLIENT_NO_FAIL, @@ -282,14 +270,8 @@ AvahiDeinit(void) avahiClient = NULL; } -#ifdef USE_EPOLL - // TODO -#else - if (avahi_glib_poll != NULL) { - avahi_glib_poll_free(avahi_glib_poll); - avahi_glib_poll = NULL; - } -#endif + delete avahi_poll; + avahi_poll = nullptr; avahi_free(avahiName); avahiName = NULL; |