[evolution-data-server] Bug 732366 - [IMAPx] Stuck FETCH command when using IDLE



commit a1ef30cfad54befca50248fcaf7a2a2c9c01d701
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 8 16:42:31 2014 +0200

    Bug 732366 - [IMAPx] Stuck FETCH command when using IDLE

 camel/providers/imapx/camel-imapx-server.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 75862d4..9151eb1 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3587,7 +3587,16 @@ imapx_job_idle_start (CamelIMAPXJob *job,
                g_mutex_unlock (&is->priv->idle_lock);
 
                QUEUE_LOCK (is);
-               imapx_command_start (is, ic);
+               /* It can be that another thread started a command between
+                  the two locks above had been interchanged, thus also test
+                  whether the active command queue is empty, before starting
+                  the IDLE command. */
+               if (camel_imapx_command_queue_is_empty (is->active)) {
+                       imapx_command_start (is, ic);
+               } else {
+                       c (is->tagprefix, "finally cancelling IDLE, other command was quicker\n");
+                       imapx_unregister_job (is, job);
+               }
        } else {
                g_mutex_unlock (&is->priv->idle_lock);
 


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