[geary/wip/improve-claiming-folder-session: 9/9] Cancel any pending commands when ImapClientConnection disconnects



commit 3487a29cd548ca0f8d32ce3c2b375d1f8d7204b6
Author: Michael Gratton <mike vee net>
Date:   Wed Nov 14 16:53:34 2018 +1100

    Cancel any pending commands when ImapClientConnection disconnects
    
    This ensures amoungst other things that when a connection goes bad and
    a reply queue command sends an IMAP command anyway, that the replay op
    will get notified and retried.

 src/engine/imap/transport/imap-client-connection.vala | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/engine/imap/transport/imap-client-connection.vala 
b/src/engine/imap/transport/imap-client-connection.vala
index 4159cb22..736b9fb6 100644
--- a/src/engine/imap/transport/imap-client-connection.vala
+++ b/src/engine/imap/transport/imap-client-connection.vala
@@ -263,6 +263,16 @@ public class Geary.Imap.ClientConnection : BaseObject {
         // close the Serializer and Deserializer
         yield close_channels_async(cancellable);
 
+        // Cancel any pending commands
+        foreach (Command pending in this.pending_queue.get_all()) {
+            debug(
+                "[%s] Cancelling pending command: %s",
+                to_string(), pending.to_string()
+            );
+            pending.cancel_command();
+        }
+        this.pending_queue.clear();
+
         // close the actual streams and the connection itself
         Error? close_err = null;
         try {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]