]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Do not schedule a new scan if no networks are enabled
authorSam Leffler <sleffler@google.com>
Wed, 14 Oct 2009 19:05:58 +0000 (22:05 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 14 Oct 2009 19:05:58 +0000 (22:05 +0300)
This avoids an extra timeout to move to INACTIVE state.

wpa_supplicant/events.c
wpa_supplicant/scan.c
wpa_supplicant/wpa_supplicant_i.h

index 391725635711e6360667fb0efd53ce793c6d9255..16f8b62a6edf7511e2fda3d29dfc65bf7963126e 100644 (file)
@@ -658,6 +658,14 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s,
                 */
                wpa_s->scan_res_tried++;
                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);
 }
index b39b8ee827ebed03dc265fa02595052e6a057ea5..770b28d228d85e97ce1cccc7b48e0e4879831d51 100644 (file)
@@ -71,7 +71,7 @@ static int wpas_wps_in_use(struct wpa_config *conf,
 #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;
        while (ssid) {
index 222be73a1a644c63e153a71820ed56d6171bb4a4..699fc0d4dc1235571eb853c3dcadab0524f50ab0 100644 (file)
@@ -452,6 +452,7 @@ int wpa_supplicant_scard_init(struct wpa_supplicant *wpa_s,
                              struct wpa_ssid *ssid);
 
 /* 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_cancel_scan(struct wpa_supplicant *wpa_s);
 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s,