zeroconf/ZeroconfBonjour: Fix compile errors resulting from "refactor to SocketEvent" and reenable bonjour for darwin build

This commit is contained in:
Richard Backhouse
2021-01-23 06:06:49 -05:00
parent 08e76815ba
commit 06fe30e2bd
2 changed files with 16 additions and 15 deletions

View File

@@ -39,9 +39,9 @@ class BonjourMonitor final {
public: public:
BonjourMonitor(EventLoop &_loop, DNSServiceRef _service_ref) BonjourMonitor(EventLoop &_loop, DNSServiceRef _service_ref)
:service_ref(_service_ref), :service_ref(_service_ref),
socket_event(SocketDescriptor(DNSServiceRefSockFD(service_ref)), socket_event(_loop,
BIND_THIS_METHOD(OnSocketReady), BIND_THIS_METHOD(OnSocketReady),
_loop) SocketDescriptor(DNSServiceRefSockFD(service_ref)))
{ {
socket_event.ScheduleRead(); socket_event.ScheduleRead();
} }
@@ -50,9 +50,13 @@ public:
DNSServiceRefDeallocate(service_ref); DNSServiceRefDeallocate(service_ref);
} }
void Cancel() noexcept {
socket_event.Cancel();
}
protected: protected:
/* virtual methods from class SocketMonitor */ /* virtual methods from class SocketMonitor */
void OnSocketReady([[maybe_unused]] unsigned flags) noexcept override { void OnSocketReady([[maybe_unused]] unsigned flags) noexcept {
DNSServiceProcessResult(service_ref); DNSServiceProcessResult(service_ref);
} }
}; };

View File

@@ -4,9 +4,7 @@ libavahi_client_dep = dependency('', required: false)
if zeroconf_option == 'auto' if zeroconf_option == 'auto'
if is_darwin if is_darwin
# Bonjour disabled for now because its build is broken zeroconf_option = 'bonjour'
#zeroconf_option = 'bonjour'
zeroconf_option = 'disabled'
elif is_android or is_windows elif is_android or is_windows
zeroconf_option = 'disabled' zeroconf_option = 'disabled'
elif dbus_dep.found() elif dbus_dep.found()
@@ -31,10 +29,12 @@ if zeroconf_option == 'bonjour'
error('dns_sd.h not found') error('dns_sd.h not found')
endif endif
if is_darwin bonjour_deps = [
bonjour_dep = declare_dependency(link_args: ['-framework', 'dnssd']) log_dep,
else ]
bonjour_dep = declare_dependency(link_args: ['-ldns_sd'])
if not is_darwin
bonjour_deps += declare_dependency(link_args: ['-ldns_sd'])
endif endif
conf.set('HAVE_BONJOUR', true) conf.set('HAVE_BONJOUR', true)
@@ -47,10 +47,7 @@ if zeroconf_option == 'bonjour'
zeroconf_dep = declare_dependency( zeroconf_dep = declare_dependency(
link_with: zeroconf, link_with: zeroconf,
dependencies: [ dependencies: bonjour_deps,
bonjour_dep,
log_dep,
],
) )
else else
if not libavahi_client_dep.found() if not libavahi_client_dep.found()