summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/EventLoop/DummyEventLoop.h20
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp6
-rw-r--r--Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h1
-rw-r--r--Swiften/LinkLocal/LinkLocalConnector.cpp4
4 files changed, 21 insertions, 10 deletions
diff --git a/Swiften/EventLoop/DummyEventLoop.h b/Swiften/EventLoop/DummyEventLoop.h
index 234ecfa..7766bd4 100644
--- a/Swiften/EventLoop/DummyEventLoop.h
+++ b/Swiften/EventLoop/DummyEventLoop.h
@@ -1,7 +1,7 @@
-#ifndef SWIFTEN_DummyEventLoop_H
-#define SWIFTEN_DummyEventLoop_H
+#pragma once
#include <deque>
+#include <iostream>
#include <boost/function.hpp>
#include "Swiften/EventLoop/EventLoop.h"
@@ -13,6 +13,13 @@ namespace Swift {
DummyEventLoop() {
}
+ ~DummyEventLoop() {
+ if (!events_.empty()) {
+ std::cerr << "DummyEventLoop: Unhandled events at destruction time" << std::endl;
+ }
+ events_.clear();
+ }
+
void processEvents() {
while (!events_.empty()) {
handleEvent(events_[0]);
@@ -20,9 +27,9 @@ namespace Swift {
}
}
- bool hasEvents() {
- return events_.size() > 0;
- }
+ bool hasEvents() {
+ return events_.size() > 0;
+ }
virtual void post(const Event& event) {
events_.push_back(event);
@@ -32,6 +39,3 @@ namespace Swift {
std::deque<Event> events_;
};
}
-
-#endif
-
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
index f7dfa11..c26f8ee 100644
--- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
+++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.cpp
@@ -13,6 +13,12 @@ namespace Swift {
FakeDNSSDQuerier::FakeDNSSDQuerier(const String& domain) : domain(domain) {
}
+FakeDNSSDQuerier::~FakeDNSSDQuerier() {
+ if (!runningQueries.empty()) {
+ std::cerr << "FakeDNSSDQuerier: Running queries not empty at destruction time" << std::endl;
+ }
+}
+
boost::shared_ptr<DNSSDBrowseQuery> FakeDNSSDQuerier::createBrowseQuery() {
return boost::shared_ptr<DNSSDBrowseQuery>(new FakeDNSSDBrowseQuery(shared_from_this()));
}
diff --git a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h
index c67ba7b..22bca0c 100644
--- a/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h
+++ b/Swiften/LinkLocal/DNSSD/Fake/FakeDNSSDQuerier.h
@@ -23,6 +23,7 @@ namespace Swift {
public boost::enable_shared_from_this<FakeDNSSDQuerier> {
public:
FakeDNSSDQuerier(const String& domain);
+ ~FakeDNSSDQuerier();
void start() {}
void stop() {}
diff --git a/Swiften/LinkLocal/LinkLocalConnector.cpp b/Swiften/LinkLocal/LinkLocalConnector.cpp
index 326d053..fba4a4e 100644
--- a/Swiften/LinkLocal/LinkLocalConnector.cpp
+++ b/Swiften/LinkLocal/LinkLocalConnector.cpp
@@ -44,9 +44,9 @@ void LinkLocalConnector::cancel() {
}
void LinkLocalConnector::handleHostnameResolved(const boost::optional<HostAddress>& address) {
+ resolveQuery->finish();
+ resolveQuery.reset();
if (address) {
- resolveQuery->finish();
- resolveQuery.reset();
connection->onConnectFinished.connect(
boost::bind(boost::ref(onConnectFinished), _1));
connection->connect(HostAddressPort(*address, service.getPort()));