[evolution-data-server] CamelNetworkService: Don't block first "host-reachable" notification.



commit 3968546a339e46d060108e5d5a04c2cc22707979
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Nov 22 12:46:25 2013 -0500

    CamelNetworkService: Don't block first "host-reachable" notification.
    
    Evolution had a similar problem recently, where an arbitrary choice of
    default for a status property we don't yet know the real initial value
    for could block the property's first "notify" signal after the initial
    value is determined.

 camel/camel-network-service.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/camel/camel-network-service.c b/camel/camel-network-service.c
index a715e6f..03855c0 100644
--- a/camel/camel-network-service.c
+++ b/camel/camel-network-service.c
@@ -47,6 +47,7 @@ struct _CamelNetworkServicePrivate {
        GMutex property_lock;
        GSocketConnectable *connectable;
        gboolean host_reachable;
+       gboolean host_reachable_set;
 
        GNetworkMonitor *network_monitor;
        gulong network_changed_handler_id;
@@ -405,7 +406,12 @@ network_service_set_host_reachable (CamelNetworkService *service,
 
        g_mutex_lock (&priv->property_lock);
 
-       if (host_reachable == priv->host_reachable) {
+       /* Host reachability is in an indeterminate state until the first
+        * time this function is called.  Don't let our arbitrary default
+        * value block the first notification signal. */
+       if (!priv->host_reachable_set) {
+               priv->host_reachable_set = TRUE;
+       } else if (host_reachable == priv->host_reachable) {
                g_mutex_unlock (&priv->property_lock);
                return;
        }


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