[geary/wip/actually-imap-logout: 2/5] Disconnect and signal logout once the command successfully completed



commit 2e11b5ea584468c33ba2c0e8f1a3cd81e53aaa61
Author: Michael Gratton <mike vee net>
Date:   Thu Feb 7 14:01:17 2019 +1100

    Disconnect and signal logout once the command successfully completed

 src/engine/imap/transport/imap-client-session.vala | 26 +++++++++++++++-------
 1 file changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap/transport/imap-client-session.vala 
b/src/engine/imap/transport/imap-client-session.vala
index 2846c779..3e3402f2 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -1497,11 +1497,20 @@ public class Geary.Imap.ClientSession : BaseObject {
         
         if (params.err != null)
             throw params.err;
-        
-        if(params.proceed)
+
+        if (params.proceed) {
             yield command_transaction_async(cmd, cancellable);
+            logged_out();
+            this.cx.disconnect_async.begin(
+                cancellable, (obj, res) => {
+                    dispatch_disconnect_results(
+                        DisconnectReason.LOCAL_CLOSE, res
+                    );
+                }
+            );
+        }
     }
-    
+
     private uint on_logout(uint state, uint event, void *user, Object? object) {
         MachineParams params = (MachineParams) object;
 
@@ -1545,15 +1554,16 @@ public class Geary.Imap.ClientSession : BaseObject {
 
     private uint on_logging_out_recv_completion(uint state, uint event, void *user, Object? object) {
         StatusResponse completion_response = (StatusResponse) object;
-        
+
+        debug("[%s] Received completion for logout: %s",
+              to_string(), completion_response.to_string());
+
         if (!validate_state_change_cmd(completion_response))
             return state;
-        
-        fsm.do_post_transition(() => { logged_out(); });
-        
+
         return State.LOGGED_OUT;
     }
-    
+
     //
     // disconnect
     //


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