summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swiften/Session/Session.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp
index 39fab14..cdb83d4 100644
--- a/Swiften/Session/Session.cpp
+++ b/Swiften/Session/Session.cpp
@@ -38,18 +38,26 @@ void Session::startSession() {
}
void Session::finishSession() {
+ if (finishing)
+ return;
finishing = true;
+ if (xmppLayer) {
+ xmppLayer->writeFooter();
+ }
connection->disconnect();
handleSessionFinished(boost::optional<SessionError>());
- finishing = false;
onSessionFinished(boost::optional<SessionError>());
}
void Session::finishSession(const SessionError& error) {
+ if (finishing)
+ return;
finishing = true;
+ if (xmppLayer) {
+ xmppLayer->writeFooter();
+ }
connection->disconnect();
handleSessionFinished(boost::optional<SessionError>(error));
- finishing = false;
onSessionFinished(boost::optional<SessionError>(error));
}