[evolution-data-server/evolution-data-server-3-12] CamelIMAPXServer not shut down properly on network outage



commit 8476b8abecb190019cf2fdfef6f0a9f3ec6e8cae
Author: Milan Crha <mcrha redhat com>
Date:   Wed Apr 2 19:12:53 2014 +0200

    CamelIMAPXServer not shut down properly on network outage
    
    Even the CamelIMAPXStore had the server removed from its references,
    the instance had been still alive in the background, when the network
    changed and the destination host was unreachable.

 camel/providers/imapx/camel-imapx-server.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index a636dd0..918dc65 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -5041,18 +5041,17 @@ camel_imapx_server_shutdown (CamelIMAPXServer *is)
 
        g_return_if_fail (CAMEL_IS_IMAPX_SERVER (is));
 
-       g_main_loop_quit (is->priv->idle_main_loop);
-       g_main_loop_quit (is->priv->parser_main_loop);
-
        QUEUE_LOCK (is);
 
        is->state = IMAPX_SHUTDOWN;
 
        cancellable = g_weak_ref_get (&is->priv->parser_cancellable);
-       g_weak_ref_set (&is->priv->parser_cancellable, NULL);
 
        QUEUE_UNLOCK (is);
 
+       g_main_loop_quit (is->priv->idle_main_loop);
+       g_main_loop_quit (is->priv->parser_main_loop);
+
        g_cancellable_cancel (cancellable);
        g_clear_object (&cancellable);
 }
@@ -7620,14 +7619,15 @@ imapx_ready_to_read (GInputStream *input_stream,
        }
 
        if (g_cancellable_is_cancelled (cancellable)) {
-               gboolean active_queue_is_empty;
+               gboolean active_queue_is_empty, is_shutdown_request;
 
                QUEUE_LOCK (is);
                active_queue_is_empty =
                        camel_imapx_command_queue_is_empty (is->active);
+               is_shutdown_request = is->state == IMAPX_SHUTDOWN;
                QUEUE_UNLOCK (is);
 
-               if (active_queue_is_empty || imapx_in_idle (is)) {
+               if (!is_shutdown_request && (active_queue_is_empty || imapx_in_idle (is))) {
                        g_cancellable_reset (cancellable);
                        g_clear_error (&local_error);
                } else {


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