Use simpler wpa_supplicant state tracking
authorSam Leffler <sleffler@google.com>
Mon, 30 Nov 2009 17:33:52 +0000 (18:33 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 30 Nov 2009 17:36:31 +0000 (18:36 +0100)
Do not remove network on transition to DISCONNECTED state, it will
be done when connection anyway. Also merge DISCONNECTED and INACTIVE
states into one.

plugins/supplicant.c

index 0d0c29b..0ca6540 100644 (file)
@@ -1625,25 +1625,6 @@ static void state_change(struct supplicant_task *task, DBusMessage *msg)
                connman_network_set_connected(task->network, TRUE);
                break;
 
-       case WPA_DISCONNECTED:
-               remove_network(task);
-
-               /* carrier off */
-               connman_network_set_connected(task->network, FALSE);
-
-               if (task->disconnecting == TRUE) {
-                       connman_network_unref(task->network);
-                       task->disconnecting = FALSE;
-
-                       if (task->pending_network != NULL) {
-                               task->network = task->pending_network;
-                               task->pending_network = NULL;
-                               task_connect(task);
-                       } else
-                               task->network = NULL;
-               }
-               break;
-
        case WPA_ASSOCIATING:
                switch (prevstate) {
                case WPA_COMPLETED:
@@ -1664,7 +1645,10 @@ static void state_change(struct supplicant_task *task, DBusMessage *msg)
                default:
                        goto badstate;
                }
+               /* fall through */
 
+       case WPA_DISCONNECTED:
+               /* carrier off */
                connman_network_set_connected(task->network, FALSE);
 
                if (task->disconnecting == TRUE) {