summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Network/Connector.cpp6
-rw-r--r--Swiften/Network/ProxiedConnection.cpp13
2 files changed, 12 insertions, 7 deletions
diff --git a/Swiften/Network/Connector.cpp b/Swiften/Network/Connector.cpp
index 5510acb..2775c97 100644
--- a/Swiften/Network/Connector.cpp
+++ b/Swiften/Network/Connector.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -50,6 +50,10 @@ void Connector::start() {
}
void Connector::stop() {
+ if (currentConnection) {
+ currentConnection->onConnectFinished.disconnect(boost::bind(&Connector::handleConnectionConnectFinished, shared_from_this(), _1));
+ currentConnection->disconnect();
+ }
finish(boost::shared_ptr<Connection>());
}
diff --git a/Swiften/Network/ProxiedConnection.cpp b/Swiften/Network/ProxiedConnection.cpp
index c44c1f5..69f719d 100644
--- a/Swiften/Network/ProxiedConnection.cpp
+++ b/Swiften/Network/ProxiedConnection.cpp
@@ -1,17 +1,15 @@
/*
- * Copyright (c) 2012-2015 Isode Limited.
+ * Copyright (c) 2012-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
-
#include <Swiften/Network/ProxiedConnection.h>
-#include <iostream>
-
#include <boost/bind.hpp>
#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Base/Log.h>
#include <Swiften/Network/ConnectionFactory.h>
#include <Swiften/Network/HostAddressPort.h>
@@ -39,7 +37,7 @@ ProxiedConnection::~ProxiedConnection() {
connection_->onDisconnected.disconnect(boost::bind(&ProxiedConnection::handleDisconnected, shared_from_this(), _1));
}
if (connected_) {
- std::cerr << "Warning: Connection was still established." << std::endl;
+ SWIFT_LOG(warning) << "Connection was still established." << std::endl;
}
}
@@ -65,8 +63,11 @@ void ProxiedConnection::listen() {
}
void ProxiedConnection::disconnect() {
+ cancelConnector();
connected_ = false;
- connection_->disconnect();
+ if (connection_) {
+ connection_->disconnect();
+ }
}
void ProxiedConnection::handleDisconnected(const boost::optional<Error>& error) {