aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/bgscan_simple.c
diff options
context:
space:
mode:
authorPaul Stewart <pstew@google.com>2011-03-31 15:06:09 (GMT)
committerJouni Malinen <j@w1.fi>2011-03-31 15:06:09 (GMT)
commit439efd1eac41bed0606f6da66a0879b8f46c4df7 (patch)
tree274467f6f1c4a80fa73e4a6321ffcc6d3f6a7f85 /wpa_supplicant/bgscan_simple.c
parent6d21d4112509da37982809817e8f83ffedb55d3b (diff)
downloadhostap-439efd1eac41bed0606f6da66a0879b8f46c4df7.zip
hostap-439efd1eac41bed0606f6da66a0879b8f46c4df7.tar.gz
hostap-439efd1eac41bed0606f6da66a0879b8f46c4df7.tar.bz2
bgscan_simple: Reschedule first fast scan
If the scan interval switches to the short interval soon after a scan, bgscan_simple should not immediately scan again. However, it should also make sure that the next scan occurs no later than the new, short scan interval. Signed-off-by: Paul Stewart <pstew@google.com>
Diffstat (limited to 'wpa_supplicant/bgscan_simple.c')
-rw-r--r--wpa_supplicant/bgscan_simple.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/wpa_supplicant/bgscan_simple.c b/wpa_supplicant/bgscan_simple.c
index a62dac1..eedc961 100644
--- a/wpa_supplicant/bgscan_simple.c
+++ b/wpa_supplicant/bgscan_simple.c
@@ -226,6 +226,18 @@ static void bgscan_simple_notify_signal_change(void *priv, int above,
os_get_time(&now);
if (now.sec > data->last_bgscan.sec + 1)
scan = 1;
+ else if (data->last_bgscan.sec + data->long_interval >
+ now.sec + data->scan_interval) {
+ /*
+ * Restart scan interval timer if currently scheduled
+ * scan is too far in the future.
+ */
+ eloop_cancel_timeout(bgscan_simple_timeout, data,
+ NULL);
+ eloop_register_timeout(data->scan_interval, 0,
+ bgscan_simple_timeout, data,
+ NULL);
+ }
} else if (data->scan_interval == data->short_interval && above) {
wpa_printf(MSG_DEBUG, "bgscan simple: Start using long bgscan "
"interval");