[evolution-data-server] [IMAPx] More pending-IDLE-detection related changes ][



commit fccbaaab9c27661f60281b9a5167f221881d910e
Author: Milan Crha <mcrha redhat com>
Date:   Fri Aug 7 12:22:36 2015 +0200

    [IMAPx] More pending-IDLE-detection related changes ][
    
    If the IDLE issued a SELECT command, and then it was cancelled, thus
    the SELECT wasn't finished, then the next command could be run
    in a wrong mailbox. Better to disconnect and open a new connection.

 camel/providers/imapx/camel-imapx-server.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 13da5c6..2aefa8a 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -5782,6 +5782,7 @@ imapx_server_idle_thread (gpointer user_data)
        GError *local_error = NULL;
        gint previous_timeout = -1;
        gboolean success = FALSE;
+       gboolean rather_disconnect = FALSE;
 
        g_return_val_if_fail (itd != NULL, NULL);
 
@@ -5820,8 +5821,10 @@ imapx_server_idle_thread (gpointer user_data)
                goto exit;
 
        success = camel_imapx_server_ensure_selected_sync (is, mailbox, idle_cancellable, &local_error);
-       if (!success)
+       if (!success) {
+               rather_disconnect = TRUE;
                goto exit;
+       }
 
        ic = camel_imapx_command_new (is, CAMEL_IMAPX_JOB_IDLE, "IDLE");
        camel_imapx_command_close (ic);
@@ -5855,9 +5858,13 @@ imapx_server_idle_thread (gpointer user_data)
        if (success)
                c (camel_imapx_server_get_tagprefix (is), "IDLE finished successfully");
        else if (local_error)
-               c (camel_imapx_server_get_tagprefix (is), "IDLE finished with error: %s", 
local_error->message);
+               c (camel_imapx_server_get_tagprefix (is), "IDLE finished with error: %s%s", 
local_error->message, rather_disconnect ? "; rather disconnect" : "");
        else
-               c (camel_imapx_server_get_tagprefix (is), "IDLE finished without error");
+               c (camel_imapx_server_get_tagprefix (is), "IDLE finished without error%s", rather_disconnect 
? "; rather disconnect" : "");
+
+       if (rather_disconnect) {
+               imapx_disconnect (is);
+       }
 
        g_clear_object (&mailbox);
        g_clear_error (&local_error);


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