[evolution-data-server/gnome-3-8] Bug 704003 - IMAPX: Untagged BYE message while connecting is lost



commit ed144954d85e9c991b46600e8c78a70a54158166
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Jul 20 14:20:16 2013 -0400

    Bug 704003 - IMAPX: Untagged BYE message while connecting is lost
    
    Do not disconnect the service in imapx_untagged_bye() if we're still
    connecting.  camel_service_disconnect_sync() will cancel the connect
    operation and the server message will get replaced with a generic
    "Operation was cancelled" message.
    
    Also, check for and handle errors when calling imapx_untagged() from
    imapx_connect_to_server().
    
    (cherry picked from commit 9b444aa32e99329cd2e8f6479ea47f81178332cc)

 camel/camel-imapx-server.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index 84d7611..cf1e590 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -2297,6 +2297,9 @@ imapx_untagged_bye (CamelIMAPXServer *is,
                     GCancellable *cancellable,
                     GError **error)
 {
+       CamelIMAPXStore *imapx_store;
+       CamelService *service;
+       CamelServiceConnectionStatus status;
        guchar *token = NULL;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
@@ -2314,6 +2317,19 @@ imapx_untagged_bye (CamelIMAPXServer *is,
 
        is->state = IMAPX_SHUTDOWN;
 
+       imapx_store = camel_imapx_server_ref_store (is);
+       service = CAMEL_SERVICE (imapx_store);
+       status = camel_service_get_connection_status (service);
+
+       /* Do not disconnect the service if we're still connecting.
+        * camel_service_disconnect_sync() will cancel the connect
+        * operation and the server message will get replaced with
+        * a generic "Operation was cancelled" message. */
+       if (status == CAMEL_SERVICE_CONNECTED)
+               camel_service_disconnect_sync (service, FALSE, NULL, NULL);
+
+       g_object_unref (imapx_store);
+
        return FALSE;
 }
 
@@ -3927,9 +3943,11 @@ imapx_connect_to_server (CamelIMAPXServer *is,
                }
 
                if (tok == '*') {
-                       imapx_untagged (
+                       success = imapx_untagged (
                                is, CAMEL_IMAPX_STREAM (imapx_stream),
                                cancellable, error);
+                       if (!success)
+                               goto exit;
                        break;
                }
                camel_imapx_stream_ungettoken (


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