[smuxi] Engine: explicitly flush message buffers in Session.Shutdown()
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Engine: explicitly flush message buffers in Session.Shutdown()
- Date: Fri, 28 Feb 2014 20:25:06 +0000 (UTC)
commit 622c8e9f5b9c73c09148ad33efb8c4b78bcb7f0b
Author: Mirco Bauer <meebey meebey net>
Date: Sun Feb 23 18:55:09 2014 +0100
Engine: explicitly flush message buffers in Session.Shutdown()
src/Engine/Session.cs | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
---
diff --git a/src/Engine/Session.cs b/src/Engine/Session.cs
index 44fce40..158206d 100644
--- a/src/Engine/Session.cs
+++ b/src/Engine/Session.cs
@@ -1716,12 +1716,37 @@ namespace Smuxi.Engine
{
Trace.Call(clean, frontendManager);
+#if LOG4NET
+ f_Logger.Debug("Shutdown(): flushing all message buffers");
+#endif
+ lock (_Chats) {
+ foreach (var chat in _Chats) {
+ try {
+ chat.MessageBuffer.Flush();
+ } catch (Exception ex) {
+#if LOG4NET
+ f_Logger.ErrorFormat(
+ "Shutdown(): {0}.MessageBuffer.Flush() " +
+ "failed, continuing with shutdown...",
+ chat.ToString()
+ );
+ f_Logger.Error("Shutdown(): Exception", ex);
+#endif
+ }
+ }
+ }
+
+ if (!clean) {
+ return;
+ }
+
+#if LOG4NET
+ f_Logger.Debug("Shutdown(): disconnecting and disposing all protocol manangers");
+#endif
lock (_ProtocolManagers) {
foreach (var protocolManager in _ProtocolManagers) {
try {
- if (clean) {
- protocolManager.Disconnect(frontendManager);
- }
+ protocolManager.Disconnect(frontendManager);
protocolManager.Dispose();
} catch (Exception ex) {
#if LOG4NET
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]