[geary/wip/733544-disconnect] When BYE received from server, begin disconnecting immediately



commit 76980dcb70bf81b6588e76237fb2d7e776469a90
Author: Jim Nelson <jim yorba org>
Date:   Thu Jul 31 16:03:06 2014 -0700

    When BYE received from server, begin disconnecting immediately
    
    Otherwise, it's possible for the server to send a BYE and drop the
    connection ungracefully (or the FCLOSE is never received) and leave
    the ClientSession active; Geary will think it's still good and attempt
    to perform operations on it.  This change will force the connection to
    drop and Geary will reestablish.

 src/engine/imap/transport/imap-client-session.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/engine/imap/transport/imap-client-session.vala 
b/src/engine/imap/transport/imap-client-session.vala
index a49620c..7f147a5 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -1011,6 +1011,11 @@ public class Geary.Imap.ClientSession : BaseObject {
             
             case Status.BYE:
                 debug("[%s] Received BYE from server: %s", to_string(), status_response.to_string());
+                
+                // nothing more we can do; drop connection and report disconnect to user
+                cx.disconnect_async.begin(null, on_bye_disconnect_completed);
+                
+                state = State.DISCONNECTING;
             break;
             
             default:
@@ -1021,6 +1026,10 @@ public class Geary.Imap.ClientSession : BaseObject {
         return state;
     }
     
+    private void on_bye_disconnect_completed(Object? source, AsyncResult result) {
+        dispatch_send_recv_results(DisconnectReason.REMOTE_CLOSE, result);
+    }
+    
     //
     // select/examine
     //


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