diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-26 15:23:28 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-26 16:43:18 (GMT) |
commit | 81ea0a6b0ea85c55c2f166b69da652aaab2ef79a (patch) | |
tree | 23ddd1388c3589bfd7d25650f4da3a1a4ab59723 /Swiften/LinkLocal/LinkLocalServiceBrowser.cpp | |
parent | e7ab68e8daf120d932d9eefc9053e9e064ca29af (diff) | |
download | swift-81ea0a6b0ea85c55c2f166b69da652aaab2ef79a.zip swift-81ea0a6b0ea85c55c2f166b69da652aaab2ef79a.tar.bz2 |
Test LinkLocal service registration.
Diffstat (limited to 'Swiften/LinkLocal/LinkLocalServiceBrowser.cpp')
-rw-r--r-- | Swiften/LinkLocal/LinkLocalServiceBrowser.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp index 265acc1..f7c5478 100644 --- a/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp +++ b/Swiften/LinkLocal/LinkLocalServiceBrowser.cpp @@ -11,7 +11,9 @@ LinkLocalServiceBrowser::LinkLocalServiceBrowser(boost::shared_ptr<DNSSDQuerier> } LinkLocalServiceBrowser::~LinkLocalServiceBrowser() { - assert(!isRunning()); + if (isRunning()) { + std::cerr << "WARNING: LinkLocalServiceBrowser still running on destruction" << std::endl; + } } @@ -67,6 +69,7 @@ void LinkLocalServiceBrowser::unregisterService() { assert(registerQuery); registerQuery->unregisterService(); registerQuery.reset(); + selfService.reset(); } std::vector<LinkLocalService> LinkLocalServiceBrowser::getServices() const { @@ -78,6 +81,9 @@ std::vector<LinkLocalService> LinkLocalServiceBrowser::getServices() const { } void LinkLocalServiceBrowser::handleServiceAdded(const DNSSDServiceID& service) { + if (selfService && service == *selfService) { + return; + } boost::shared_ptr<DNSSDResolveServiceQuery> resolveQuery = querier->createResolveServiceQuery(service); resolveQuery->onServiceResolved.connect( boost::bind(&LinkLocalServiceBrowser::handleServiceResolved, this, service, _1)); @@ -89,6 +95,9 @@ void LinkLocalServiceBrowser::handleServiceAdded(const DNSSDServiceID& service) } void LinkLocalServiceBrowser::handleServiceRemoved(const DNSSDServiceID& service) { + if (selfService && service == *selfService) { + return; + } ResolveQueryMap::iterator i = resolveQueries.find(service); assert(i != resolveQueries.end()); i->second->stop(); @@ -111,7 +120,10 @@ void LinkLocalServiceBrowser::handleServiceResolved(const DNSSDServiceID& servic } void LinkLocalServiceBrowser::handleRegisterFinished(const boost::optional<DNSSDServiceID>& result) { - if (!result) { + if (result) { + selfService = result; + } + else { haveError = true; stop(); } |