Remove the disconnected state once connected
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 21 Jan 2009 18:55:37 +0000 (19:55 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 21 Jan 2009 18:55:37 +0000 (19:55 +0100)
src/device.c
src/network.c

index 293055b..00b8019 100644 (file)
@@ -1036,6 +1036,8 @@ void __connman_device_disconnect(struct connman_device *device)
 
        DBG("device %p", device);
 
+       connman_device_set_disconnected(device, TRUE);
+
        g_hash_table_iter_init(&iter, device->networks);
 
        while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
index 45213a9..c41871d 100644 (file)
@@ -245,8 +245,6 @@ static DBusMessage *do_connect(DBusConnection *conn,
        } else
                network->connected = TRUE;
 
-       connman_device_set_disconnected(network->device, FALSE);
-
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }
 
@@ -267,6 +265,8 @@ static DBusMessage *do_disconnect(DBusConnection *conn,
 
        connman_element_unregister_children(&network->element);
 
+       connman_device_set_disconnected(network->device, TRUE);
+
        if (network->driver && network->driver->disconnect) {
                err = network->driver->disconnect(network);
                if (err < 0 && err != -EINPROGRESS)
@@ -274,8 +274,6 @@ static DBusMessage *do_disconnect(DBusConnection *conn,
        } else
                network->connected = FALSE;
 
-       connman_device_set_disconnected(network->device, TRUE);
-
        return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }
 
@@ -680,6 +678,8 @@ int connman_network_set_connected(struct connman_network *network,
 
                __connman_device_set_network(network->device, network);
 
+               connman_device_set_disconnected(network->device, FALSE);
+
                element = connman_element_create(NULL);
                if (element != NULL) {
                        element->type  = type;