summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-04-24 16:58:52 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-04-24 16:58:52 (GMT)
commitd3ade7a21cf2cc5e394eccca302e20360052a164 (patch)
tree127f1a3c8965370893fdc786b36096dd0b55879b /Swiften/LinkLocal/DNSSD/Fake
parentc6f259526edd486961b798be2537f89f73b1cb81 (diff)
downloadswift-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/Fake')
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp1
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h13
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;