diff options
Diffstat (limited to 'Swiften/Client/Client.cpp')
-rw-r--r-- | Swiften/Client/Client.cpp | 7 |
1 files changed, 4 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 @@ -69,15 +69,16 @@ void Client::handleConnectorFinished(boost::shared_ptr<Connection> connection) { } } void Client::disconnect() { if (session_) { session_->finish(); - session_.reset(); } - closeConnection(); + else { + closeConnection(); + } } void Client::closeConnection() { if (sessionStream_) { sessionStream_.reset(); } @@ -133,12 +134,13 @@ void Client::handleElement(boost::shared_ptr<Element> element) { void Client::setCertificate(const String& certificate) { certificate_ = certificate; } void Client::handleSessionFinished(boost::shared_ptr<Error> error) { + session_.reset(); closeConnection(); if (error) { ClientError clientError; if (boost::shared_ptr<ClientSession::Error> actualError = boost::dynamic_pointer_cast<ClientSession::Error>(error)) { switch(actualError->type) { case ClientSession::Error::AuthenticationFailedError: @@ -188,13 +190,12 @@ void Client::handleSessionFinished(boost::shared_ptr<Error> error) { clientError = ClientError(ClientError::ConnectionWriteError); break; } } onError(clientError); } - session_.reset(); } void Client::handleNeedCredentials() { assert(session_); session_->sendCredentials(password_); } |