summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/BOSHConnection.cpp')
-rw-r--r--Swiften/Network/BOSHConnection.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Swiften/Network/BOSHConnection.cpp b/Swiften/Network/BOSHConnection.cpp
index 539109a..377373d 100644
--- a/Swiften/Network/BOSHConnection.cpp
+++ b/Swiften/Network/BOSHConnection.cpp
@@ -51,29 +51,32 @@ void BOSHConnection::connect() {
connector_->start();
}
void BOSHConnection::cancelConnector() {
if (connector_) {
connector_->onConnectFinished.disconnect(boost::bind(&BOSHConnection::handleConnectFinished, shared_from_this(), _1));
connector_->stop();
connector_.reset();
}
}
void BOSHConnection::disconnect() {
- cancelConnector();
- if(connection_) {
+ if (connection_) {
connection_->disconnect();
sid_ = "";
}
+ else {
+ /* handleDisconnected takes care of the connector_ as well */
+ handleDisconnected(boost::optional<Connection::Error>());
+ }
}
void BOSHConnection::restartStream() {
write(createSafeByteArray(""), true, false);
}
void BOSHConnection::terminateStream() {
write(createSafeByteArray(""), false, true);
}
void BOSHConnection::write(const SafeByteArray& data) {