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>
This commit is contained in:
Paul Stewart 2011-03-31 18:06:09 +03:00 committed by Jouni Malinen
parent 6d21d41125
commit 439efd1eac

View file

@ -226,6 +226,18 @@ static void bgscan_simple_notify_signal_change(void *priv, int above,
os_get_time(&now); os_get_time(&now);
if (now.sec > data->last_bgscan.sec + 1) if (now.sec > data->last_bgscan.sec + 1)
scan = 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) { } else if (data->scan_interval == data->short_interval && above) {
wpa_printf(MSG_DEBUG, "bgscan simple: Start using long bgscan " wpa_printf(MSG_DEBUG, "bgscan simple: Start using long bgscan "
"interval"); "interval");