[evolution-data-server] CamelNetworkService: Disconnect as needed.



commit 3bab776a8c6bf8618ff30c84fb68b23f99bfb846
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Nov 14 00:52:47 2013 -0500

    CamelNetworkService: Disconnect as needed.
    
    Disconnect immediately if the host is not reachable.

 camel/camel-network-service.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/camel/camel-network-service.c b/camel/camel-network-service.c
index 13a55c2..a715e6f 100644
--- a/camel/camel-network-service.c
+++ b/camel/camel-network-service.c
@@ -415,6 +415,21 @@ network_service_set_host_reachable (CamelNetworkService *service,
        g_mutex_unlock (&priv->property_lock);
 
        g_object_notify (G_OBJECT (service), "host-reachable");
+
+       /* Disconnect immediately if the host is not reachable.
+        * Then connect lazily when the host becomes reachable. */
+       if (!host_reachable) {
+               GError *local_error = NULL;
+
+               /* XXX Does this actually block in any providers?
+                *     If so then we need to do it asynchronously. */
+               camel_service_disconnect_sync (
+                       CAMEL_SERVICE (service), FALSE, NULL, &local_error);
+               if (local_error != NULL) {
+                       g_warning ("%s: %s", G_STRFUNC, local_error->message);
+                       g_error_free (local_error);
+               }
+       }
 }
 
 static void


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