From 3180d7a2088fdd429c2eb9ae74abfa96e6a9b9b0 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Mon, 14 Sep 2009 17:25:03 +0300 Subject: [PATCH] Getting back to DISCONNECTED afer SCANNING After transitioning from DISCONNECTED to SCANNING, we never go back to DISCONNECTED even though scanning is done or failed. We're thus stuck in SCANNING while scanning is actually done. --- wpa_supplicant/events.c | 8 ++++++-- wpa_supplicant/scan.c | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 7c98f5344..03d0e1fde 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -650,10 +650,14 @@ static void wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s) wpas_notify_scan_done(wpa_s, 1); - if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s)) || - wpa_s->disconnected) + if ((wpa_s->conf->ap_scan == 2 && !wpas_wps_searching(wpa_s))) return; + if (wpa_s->disconnected) { + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); + return; + } + while (selected == NULL) { for (prio = 0; prio < wpa_s->conf->num_prio; prio++) { selected = wpa_supplicant_select_bss( diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 10eb525bb..e122e670d 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -191,8 +191,10 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) struct wpa_driver_scan_params params; size_t max_ssids; - if (wpa_s->disconnected && !wpa_s->scan_req) + if (wpa_s->disconnected && !wpa_s->scan_req) { + wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); return; + } if (!wpa_supplicant_enabled_networks(wpa_s->conf) && !wpa_s->scan_req) {