diff options
Diffstat (limited to 'Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h')
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h index 62d8606..8e3181e 100644 --- a/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h +++ b/Swiften/LinkLocal/DNSSD/Bonjour/BonjourBrowseQuery.h @@ -14,14 +14,17 @@ namespace Swift { &sdRef, 0, 0, "_presence._tcp", 0, &BonjourBrowseQuery::handleServiceDiscoveredStatic, this); if (result != kDNSServiceErr_NoError) { - std::cout << "Error" << std::endl; - // TODO + sdRef = NULL; } } void startBrowsing() { - assert(sdRef); - run(); + if (!sdRef) { + MainEventLoop::postEvent(boost::bind(boost::ref(onError)), shared_from_this()); + } + else { + run(); + } } void stopBrowsing() { @@ -35,7 +38,7 @@ namespace Swift { void handleServiceDiscovered(DNSServiceFlags flags, uint32_t interfaceIndex, DNSServiceErrorType errorCode, const char *name, const char *type, const char *domain) { if (errorCode != kDNSServiceErr_NoError) { - return; + MainEventLoop::postEvent(boost::bind(boost::ref(onError)), shared_from_this()); } else { DNSSDServiceID service(name, type, domain, interfaceIndex); |