Do not schedule a new scan if no networks are enabled

This avoids an extra timeout to move to INACTIVE state.
This commit is contained in:
Sam Leffler 2009-10-14 22:05:58 +03:00 committed by Jouni Malinen
parent 3afe7b61e0
commit 4f34d51abe
3 changed files with 10 additions and 1 deletions

View file

@ -658,6 +658,14 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
*/ */
wpa_s->scan_res_tried++; wpa_s->scan_res_tried++;
timeout = 0; timeout = 0;
} else if (!wpa_supplicant_enabled_networks(wpa_s->conf)) {
/*
* No networks are enabled; short-circuit request so
* we don't wait timeout seconds before transitioning
* to INACTIVE state.
*/
wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
return;
} }
wpa_supplicant_req_scan(wpa_s, timeout, 0); wpa_supplicant_req_scan(wpa_s, timeout, 0);
} }

View file

@ -71,7 +71,7 @@ static int wpas_wps_in_use(struct wpa_config *conf,
#endif /* CONFIG_WPS */ #endif /* CONFIG_WPS */
static int wpa_supplicant_enabled_networks(struct wpa_config *conf) int wpa_supplicant_enabled_networks(struct wpa_config *conf)
{ {
struct wpa_ssid *ssid = conf->ssid; struct wpa_ssid *ssid = conf->ssid;
while (ssid) { while (ssid) {

View file

@ -452,6 +452,7 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid); struct wpa_ssid *ssid);
/* scan.c */ /* scan.c */
int wpa_supplicant_enabled_networks(struct wpa_config *conf);
void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec); void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec);
void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s); void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s);
void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s, void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,