[evolution-data-server/gnome-3-20] [IMAPx] Retry only once, not indefinitely



commit 2c4080e3c00ef123a9d583c9b5c242de08958af5
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 5 10:35:18 2016 +0200

    [IMAPx] Retry only once, not indefinitely
    
    If there's any server or connection issue, then indefinite retrying
    only breaks the server and wastes bandwidth, thus rather retry only
    once and give up otherwise. One such case was reported in bug #764307.

 camel/providers/imapx/camel-imapx-conn-manager.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-conn-manager.c 
b/camel/providers/imapx/camel-imapx-conn-manager.c
index c7a9064..fbc2188 100644
--- a/camel/providers/imapx/camel-imapx-conn-manager.c
+++ b/camel/providers/imapx/camel-imapx-conn-manager.c
@@ -1087,7 +1087,7 @@ camel_imapx_conn_manager_run_job_sync (CamelIMAPXConnManager *conn_man,
 {
        GSList *link;
        ConnectionInfo *cinfo;
-       gboolean success = FALSE;
+       gboolean success = FALSE, retrying;
        GError *local_error = NULL;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_CONN_MANAGER (conn_man), FALSE);
@@ -1160,6 +1160,9 @@ camel_imapx_conn_manager_run_job_sync (CamelIMAPXConnManager *conn_man,
        JOB_QUEUE_UNLOCK (conn_man);
 
        do {
+               /* Retry only once, not indefinitely */
+               retrying = g_error_matches (local_error, CAMEL_IMAPX_SERVER_ERROR, 
CAMEL_IMAPX_SERVER_ERROR_TRY_RECONNECT);
+
                g_clear_error (&local_error);
 
                cinfo = camel_imapx_conn_manager_ref_connection (conn_man, camel_imapx_job_get_mailbox (job), 
cancellable, error);
@@ -1302,7 +1305,7 @@ camel_imapx_conn_manager_run_job_sync (CamelIMAPXConnManager *conn_man,
 
                        connection_info_unref (cinfo);
                }
-       } while (!success && g_error_matches (local_error, CAMEL_IMAPX_SERVER_ERROR, 
CAMEL_IMAPX_SERVER_ERROR_TRY_RECONNECT));
+       } while (!success && !retrying && g_error_matches (local_error, CAMEL_IMAPX_SERVER_ERROR, 
CAMEL_IMAPX_SERVER_ERROR_TRY_RECONNECT));
 
        if (local_error)
                g_propagate_error (error, local_error);


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