From 5887a9d552f3d9d612011daba073e076daab5b2a Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Fri, 14 Sep 2012 10:47:43 -0700 Subject: wpa_supplicant: Skip unnecessary scan attempts Change-Id: Ieea8843c0fcb063dbb1df56e5cdf3fbdd0590cd4 Signed-off-by: Dmitry Shmidt --- wpa_supplicant/p2p_supplicant.c | 5 ----- wpa_supplicant/scan.c | 8 +++++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 2cd2e8e..76f50c7 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -5346,12 +5346,7 @@ unsigned int wpas_p2p_search_delay(struct wpa_supplicant *wpa_s) rn2 = ifs->driver->get_radio_name(ifs->drv_priv); if (!rn2 || os_strcmp(rn, rn2) != 0) continue; -#ifdef ANDROID_P2P - /* We need not delay the p2p_scan if STA is already connected */ - if (ifs->wpa_state > WPA_SCANNING && ifs->wpa_state < WPA_COMPLETED) { -#else if (ifs->wpa_state > WPA_SCANNING) { -#endif wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use %u ms search " "delay due to concurrent operation on " "interface %s", diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index f088da1..8c548b3 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -453,7 +453,13 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); return; } - +#ifdef ANDROID + if (wpa_s->scanning) { + /* If we are already in scanning state, we shall ignore this new scan request*/ + wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - already scanning"); + return; + } +#endif if (!wpa_supplicant_enabled_networks(wpa_s) && !wpa_s->scan_req) { wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan"); -- cgit v1.1