diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-24 16:58:52 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-24 16:58:52 (GMT) |
commit | d3ade7a21cf2cc5e394eccca302e20360052a164 (patch) | |
tree | 127f1a3c8965370893fdc786b36096dd0b55879b /Swiften/LinkLocal/DNSSD | |
parent | c6f259526edd486961b798be2537f89f73b1cb81 (diff) | |
download | swift-contrib-d3ade7a21cf2cc5e394eccca302e20360052a164.zip swift-contrib-d3ade7a21cf2cc5e394eccca302e20360052a164.tar.bz2 |
Don't lookup duplicate discovered link-local services.
This fixes a segfault due to the old query being deleted when a
duplicate query is started.
Diffstat (limited to 'Swiften/LinkLocal/DNSSD')
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp | 1 | ||||
-rw-r--r-- | Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp index 0ef8c74..d8e7acf 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp @@ -43,6 +43,7 @@ boost::shared_ptr<DNSSDResolveHostnameQuery> FakeDNSSDQuerier::createResolveHost void FakeDNSSDQuerier::addRunningQuery(boost::shared_ptr<FakeDNSSDQuery> query) { runningQueries.push_back(query); + allQueriesEverRun.push_back(query); if (boost::shared_ptr<FakeDNSSDBrowseQuery> browseQuery = boost::dynamic_pointer_cast<FakeDNSSDBrowseQuery>(query)) { foreach(const DNSSDServiceID& service, services) { MainEventLoop::postEvent(boost::bind(boost::ref(browseQuery->onServiceAdded), service), shared_from_this()); diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h index 7ff092d..ef7af02 100644 --- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h +++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h @@ -54,6 +54,18 @@ namespace Swift { void setBrowseError(); void setRegisterError(); + public: + template<typename T> + std::vector< boost::shared_ptr<T> > getAllQueriesEverRun() const { + std::vector< boost::shared_ptr<T> > result; + foreach(const boost::shared_ptr<FakeDNSSDQuery>& query, allQueriesEverRun) { + if (boost::shared_ptr<T> resultQuery = boost::dynamic_pointer_cast<T>(query)) { + result.push_back(resultQuery); + } + } + return result; + } + private: template<typename T> std::vector< boost::shared_ptr<T> > getQueries() const { @@ -69,6 +81,7 @@ namespace Swift { private: String domain; std::list< boost::shared_ptr<FakeDNSSDQuery> > runningQueries; + std::list< boost::shared_ptr<FakeDNSSDQuery> > allQueriesEverRun; std::set<DNSSDServiceID> services; typedef std::map<DNSSDServiceID,DNSSDResolveServiceQuery::Result> ServiceInfoMap; ServiceInfoMap serviceInfo; |