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



commit 9b444aa32e99329cd2e8f6479ea47f81178332cc
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().

 camel/camel-imapx-server.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c
index b242a5d..09b5872 100644
--- a/camel/camel-imapx-server.c
+++ b/camel/camel-imapx-server.c
@@ -2297,7 +2297,9 @@ imapx_untagged_bye (CamelIMAPXServer *is,
                     GCancellable *cancellable,
                     GError **error)
 {
-       CamelIMAPXStore *store;
+       CamelIMAPXStore *imapx_store;
+       CamelService *service;
+       CamelServiceConnectionStatus status;
        guchar *token = NULL;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_SERVER (is), FALSE);
@@ -2313,11 +2315,18 @@ imapx_untagged_bye (CamelIMAPXServer *is,
 
        is->state = IMAPX_SHUTDOWN;
 
-       /* Disconnect the CamelIMAPXStore. */
-       store = camel_imapx_server_ref_store (is);
-       camel_service_disconnect_sync (
-               CAMEL_SERVICE (store), FALSE, NULL, NULL);
-       g_object_unref (store);
+       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;
 }
@@ -3941,9 +3950,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]