From b92241ff6c42441d0b0f57f3db9a2a0028bfdfa7 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Wed, 25 Apr 2012 18:39:19 +0300 Subject: wifi: Be connected when relevant, stay connected if roaming --- plugins/wifi.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/plugins/wifi.c b/plugins/wifi.c index 9ce380b0..6f750e53 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -1180,7 +1180,9 @@ static void interface_state(GSupplicantInterface *interface) case G_SUPPLICANT_STATE_ASSOCIATING: stop_autoscan(device); - connman_network_set_associating(network, TRUE); + if (wifi->connected == FALSE) + connman_network_set_associating(network, TRUE); + break; case G_SUPPLICANT_STATE_COMPLETED: @@ -1245,6 +1247,34 @@ static void interface_state(GSupplicantInterface *interface) wifi->state = state; + /* Saving wpa_s state policy: + * If connected and if the state changes are roaming related: + * --> We stay connected + * If completed + * --> We are connected + * All other case: + * --> We are not connected + * */ + switch (state) { + case G_SUPPLICANT_STATE_AUTHENTICATING: + case G_SUPPLICANT_STATE_ASSOCIATING: + case G_SUPPLICANT_STATE_ASSOCIATED: + case G_SUPPLICANT_STATE_4WAY_HANDSHAKE: + case G_SUPPLICANT_STATE_GROUP_HANDSHAKE: + if (wifi->connected == TRUE) + connman_warn("Probably roaming right now!" + " Staying connected..."); + else + wifi->connected = FALSE; + break; + case G_SUPPLICANT_STATE_COMPLETED: + wifi->connected = TRUE; + break; + default: + wifi->connected = FALSE; + break; + } + DBG("DONE"); } -- cgit v1.2.3