From 86844bd1818c389d471977303121b03fe15e992a Mon Sep 17 00:00:00 2001
From: HanzZ <hanzz.k@gmail.com>
Date: Sat, 18 Jun 2011 20:47:50 +0200
Subject: Send footer when finishing session

License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php

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));
 }
 
-- 
cgit v0.10.2-6-g49f6


From e61e188ade3a42f7fd5ef4d6e5673d55e99a51f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 19 Jun 2011 19:48:15 +0200
Subject: Small tweak to previous patch.


diff --git a/Swiften/Session/Session.cpp b/Swiften/Session/Session.cpp
index cdb83d4..0c38f07 100644
--- a/Swiften/Session/Session.cpp
+++ b/Swiften/Session/Session.cpp
@@ -38,8 +38,9 @@ void Session::startSession() {
 }
 
 void Session::finishSession() {
-	if (finishing)
+	if (finishing) {
 		return;
+	}
 	finishing = true;
 	if (xmppLayer) {
 		xmppLayer->writeFooter();
@@ -50,8 +51,9 @@ void Session::finishSession() {
 }
 
 void Session::finishSession(const SessionError& error) {
-	if (finishing)
+	if (finishing) {
 		return;
+	}
 	finishing = true;
 	if (xmppLayer) {
 		xmppLayer->writeFooter();
-- 
cgit v0.10.2-6-g49f6