summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/Session.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp
index 1d78640..e8b8308 100644
--- a/Swiften/Session/Session.cpp
+++ b/Swiften/Session/Session.cpp
@@ -38,18 +38,28 @@ 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));
}