ConnMan should connect the corresponding network/service after a
successful response to context activation request. If the context was
already active, connecting has to happen this way instead of waiting for
active property going up (it already is up).

In case the context was inactive before activation, it will not have
network index yet and connecting will happen later when activation is
ready.

This patch removes the reply handler for context inactivation because
it would have no other use than logging.
---
 plugins/ofono.c |   41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 92ab9d7..bd6fbf9 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -433,20 +437,31 @@ done:
        dbus_pending_call_unref(call);
 }
 
-static int set_network_active(struct connman_network *network,
-                                               dbus_bool_t active)
+static int set_network_active(struct connman_network *network)
 {
-       int error;
+       dbus_bool_t value = TRUE;
+       const char *path = connman_network_get_string(network, "Path");
+
+       DBG("network %p, path %s", network, path);
+
+       return set_property(path, OFONO_CONTEXT_INTERFACE,
+                               "Active", DBUS_TYPE_BOOLEAN, &value,
+                               set_active_reply, g_strdup(path), g_free);
+}
 
+static int set_network_inactive(struct connman_network *network)
+{
+       int error;
+       dbus_bool_t value = FALSE;
        const char *path = connman_network_get_string(network, "Path");
 
-       DBG("network %p, path %s, active %d", network, path, active);
+       DBG("network %p, path %s", network, path);
 
        error = set_property(path, OFONO_CONTEXT_INTERFACE,
-                               "Active", DBUS_TYPE_BOOLEAN, &active,
-                               set_active_reply, g_strdup(path), g_free);
+                               "Active", DBUS_TYPE_BOOLEAN, &value,
+                               NULL, NULL, NULL);
 
-       if (active == FALSE && error == -EINPROGRESS)
+       if (error == -EINPROGRESS)
                error = 0;
 
        return error;
-- 
1.7.0.4


_______________________________________________
connman mailing list
connman@connman.net
http://lists.connman.net/listinfo/connman

Reply via email to