Release 0.10
[connman] / src / network.c
index b3d8812..c41871d 100644 (file)
@@ -265,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)
@@ -676,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;
@@ -1109,15 +1113,13 @@ static int network_load(struct connman_network *network)
        if (val > 0)
                network->priority = val;
 
-       if (network->remember == TRUE) {
-               g_free(network->wifi.security);
-               network->wifi.security = g_key_file_get_string(keyfile,
+       g_free(network->wifi.security);
+       network->wifi.security = g_key_file_get_string(keyfile,
                                network->identifier, "WiFi.Security", NULL);
 
-               g_free(network->wifi.passphrase);
-               network->wifi.passphrase = g_key_file_get_string(keyfile,
+       g_free(network->wifi.passphrase);
+       network->wifi.passphrase = g_key_file_get_string(keyfile,
                                network->identifier, "WiFi.Passphrase", NULL);
-       }
 
        g_key_file_free(keyfile);
 
@@ -1162,7 +1164,7 @@ update:
                g_key_file_set_integer(keyfile, network->identifier,
                                                "Priority", network->priority);
 
-       if (network->remember == TRUE) {
+       if (network->remember == TRUE || network->connected == TRUE) {
                if (network->wifi.security != NULL)
                        g_key_file_set_string(keyfile, network->identifier,
                                "WiFi.Security", network->wifi.security);