[geary] Return to IDLE properly when connection lulls



commit 2095ae955e1d562f5b170a1c212853c75c838879
Author: Jim Nelson <jim yorba org>
Date:   Tue Nov 11 18:24:16 2014 -0800

    Return to IDLE properly when connection lulls
    
    Commit 96aaf3 fixed a bug with regard to IDLE status responses being
    improperly reported to ClientSession.  As it turned out, that fix
    introduced a bug by not properly decrementing outstanding_cmds, which
    left the ClientConnection in a state where it would never enter IDLE
    thereafter.
    
    The problem is a change I pondered at the time but didn't commit due
    to that fix being so close to release time: not reporting the original
    IDLE command to ClientSession either.  That in itself is harmless, but
    not doing that also avoids incrementing outstanding_cmds for that
    command, meaning when the IDLE completes that value returns to zero
    and the ClientConnection is in an appropriate state to return to IDLE
    when ready.

 .../imap/transport/imap-client-connection.vala     |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap/transport/imap-client-connection.vala 
b/src/engine/imap/transport/imap-client-connection.vala
index 6dc6df9..9a88834 100644
--- a/src/engine/imap/transport/imap-client-connection.vala
+++ b/src/engine/imap/transport/imap-client-connection.vala
@@ -633,9 +633,6 @@ public class Geary.Imap.ClientConnection : BaseObject {
     }
     
     private async void do_flush_async() {
-        // need to signal when the IDLE command is sent, for completeness
-        IdleCommand? idle_cmd = null;
-        
         // Like send_async(), need to use mutex when flushing as Serializer must be accessed in
         // serialized fashion
         //
@@ -714,7 +711,7 @@ public class Geary.Imap.ClientConnection : BaseObject {
             // as connection is "quiet" (haven't seen new command in n msec), go into IDLE state
             // if (a) allowed by owner, (b) allowed by state machine, and (c) no commands outstanding
             if (ser != null && idle_when_quiet && outstanding_cmds == 0 && 
issue_conditional_event(Event.SEND_IDLE)) {
-                idle_cmd = new IdleCommand();
+                IdleCommand idle_cmd = new IdleCommand();
                 idle_cmd.assign_tag(generate_tag());
                 
                 // store IDLE tag to watch for response later (many responses could arrive before it)
@@ -733,7 +730,6 @@ public class Geary.Imap.ClientConnection : BaseObject {
                 assert(synchronize_tag == null);
             }
         } catch (Error err) {
-            idle_cmd = null;
             send_failure(err);
         } finally {
             if (token != Nonblocking.Mutex.INVALID_TOKEN) {
@@ -744,9 +740,6 @@ public class Geary.Imap.ClientConnection : BaseObject {
                 }
             }
         }
-        
-        if (idle_cmd != null)
-            sent_command(idle_cmd);
     }
     
     private void check_for_connection() throws Error {


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