summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/Client/Client.cpp7
-rw-r--r--Swiften/Client/ClientSession.cpp3
-rw-r--r--Swiften/Client/ClientSession.h1
3 files changed, 8 insertions, 3 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp
index e9de19a..27f3d9c 100644
--- a/Swiften/Client/Client.cpp
+++ b/Swiften/Client/Client.cpp
@@ -72,9 +72,10 @@ void Client::handleConnectorFinished(boost::shared_ptr<Connection> connection) {
void Client::disconnect() {
if (session_) {
session_->finish();
- session_.reset();
}
- closeConnection();
+ else {
+ closeConnection();
+ }
}
void Client::closeConnection() {
@@ -136,6 +137,7 @@ void Client::setCertificate(const String& certificate) {
}
void Client::handleSessionFinished(boost::shared_ptr<Error> error) {
+ session_.reset();
closeConnection();
if (error) {
ClientError clientError;
@@ -191,7 +193,6 @@ void Client::handleSessionFinished(boost::shared_ptr<Error> error) {
}
onError(clientError);
}
- session_.reset();
}
void Client::handleNeedCredentials() {
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 8427d27..16bda40 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -34,6 +34,9 @@ ClientSession::ClientSession(
authenticator(NULL) {
}
+ClientSession::~ClientSession() {
+}
+
void ClientSession::start() {
stream->onStreamStartReceived.connect(boost::bind(&ClientSession::handleStreamStart, shared_from_this(), _1));
stream->onElementReceived.connect(boost::bind(&ClientSession::handleElement, shared_from_this(), _1));
diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h
index ef4d747..685672e 100644
--- a/Swiften/Client/ClientSession.h
+++ b/Swiften/Client/ClientSession.h
@@ -46,6 +46,7 @@ namespace Swift {
Error(Type type) : type(type) {}
};
+ ~ClientSession();
static boost::shared_ptr<ClientSession> create(const JID& jid, boost::shared_ptr<SessionStream> stream) {
return boost::shared_ptr<ClientSession>(new ClientSession(jid, stream));
}