[evolution-data-server/evolution-data-server-3-12] imapx_register_job: Try reconnect if the server is shutdown/disconnected



commit 8e47a21686be44b216394804c3d0d291bd45084f
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 5 18:24:13 2014 +0200

    imapx_register_job: Try reconnect if the server is shutdown/disconnected
    
    There could sometimes bubble "Not authenticated" error up to the UI,
    which didn't look nicely and was not necessary, because in the case
    of the server being shutdown or disconnected it's easy to reconnect.
    The "Not authenticated" error message is still used, only the error
    code is different, it tells the caller to reconnect.

 camel/providers/imapx/camel-imapx-conn-manager.c |    4 ++--
 camel/providers/imapx/camel-imapx-server.c       |    8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-conn-manager.c 
b/camel/providers/imapx/camel-imapx-conn-manager.c
index dce259c..29fdbcb 100644
--- a/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -668,7 +668,7 @@ exit:
                for (link = list; link != NULL; link = g_list_next (link)) {
                        ConnectionInfo *candidate = link->data;
 
-                       printf ("   cmds:%d has-expensive:%d avail:%d cinfo:%p\n", 
camel_imapx_server_get_command_count (candidate->is), camel_imapx_server_has_expensive_command 
(candidate->is), connection_info_is_available (candidate), candidate);
+                       printf ("   cmds:%d has-expensive:%d avail:%d cinfo:%p server:%p\n", 
camel_imapx_server_get_command_count (candidate->is), camel_imapx_server_has_expensive_command 
(candidate->is), connection_info_is_available (candidate), candidate, candidate->is);
                }
        }
 
@@ -751,7 +751,7 @@ imapx_create_new_connection_unlocked (CamelIMAPXConnManager *con_man,
        con_man->priv->connections = g_list_prepend (
                con_man->priv->connections, cinfo);
 
-       c (is->tagprefix, "Created new connection for %s and total connections %d \n", folder_name, 
g_list_length (con_man->priv->connections));
+       c (is->tagprefix, "Created new connection %p (server:%p) for %s; total connections %d\n", cinfo, 
cinfo->is, folder_name, g_list_length (con_man->priv->connections));
 
 exit:
        g_object_unref (store);
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 3f1e8ca..e12f309 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1000,8 +1000,14 @@ imapx_register_job (CamelIMAPXServer *is,
                imapx_server_job_added (is, job);
                QUEUE_UNLOCK (is);
 
+       } else if (is->state <= IMAPX_SHUTDOWN) {
+               e (is->tagprefix, "Server is shutdown/disconnected, try reconnect.");
+               g_set_error (error,
+                       CAMEL_IMAPX_SERVER_ERROR, CAMEL_IMAPX_SERVER_ERROR_TRY_RECONNECT,
+                       _("Not authenticated"));
+               return FALSE;
        } else {
-               e (is->tagprefix, "NO connection yet, maybe user cancelled jobs earlier ?");
+               e (is->tagprefix, "Not connected yet, maybe user cancelled jobs earlier?");
                g_set_error (
                        error, CAMEL_SERVICE_ERROR,
                        CAMEL_SERVICE_ERROR_NOT_CONNECTED,


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