shill: when wifi is disconnected, periodically scan for APs
The timer is started when the device is started, and re-arms
itself every time it fires.
Additionally, the timer is reset when 1) the scan interval is reconfigured,
or 2) a scan completes. Note that while item 2 does not eliminate the value
of re-arming the timer whenever it fires. This is because not every firing
of the timer will initiate a scan. Further, even if every firing initiated a
scan, re-arming the timer provides us some robustness in case supplicant
fails to generate a ScanDone signal.
We choose not to reset the timer when a connection is established, because
the timer is irrelevant while we are connected. We choose not to reset the
timer when a connection fails, because it is likely that supplicant performed
a scan befor giving up on the connection. (So we can use our existing BSS
cache entries, rather than spending time scanning.)
However, as a special case, we initiate a scan when we are disconnected,
and have some hidden SSIDs that we might want to connect to. See the comment
in WiFi::CurrentBSSChanged for the rationale.
Bonus change: update device-api.txt values for the default scan interval.
BUG=chromium-os:24337
TEST=new unit tests, manual (see below)
Manual testing:
- ff_debug +wifi
- connect to WiFi network, wait 6 minutes, check that foreground
scan did not run. (grep "ScanTimerHandler", see that there's no
"scan requested" near it.)
- disconnect from WiFi network, wait 6 minutes, check that foreground
scan ran. (grep "ScanTimerHandler, see the "scan requested" soon after.)
Change-Id: I9f9e896743681bdcac321245c591479bff7e630a
Reviewed-on: https://gerrit.chromium.org/gerrit/22057
Reviewed-by: Gary Morain <gmorain@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: mukesh agrawal <quiche@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
4 files changed