diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-06-15 14:13:48 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-06-18 10:59:27 +0300 |
commit | 12c4d5c3b438d12c6ec60524edb474fb8312c0c6 (patch) | |
tree | 7cd2bea7c300cd39ce298f4999158811a853cae8 /plugins | |
parent | e28dffca0bf6a1d0dcc69e4abb52a22e0b0578be (diff) | |
download | connman-12c4d5c3b438d12c6ec60524edb474fb8312c0c6.tar.gz connman-12c4d5c3b438d12c6ec60524edb474fb8312c0c6.tar.bz2 connman-12c4d5c3b438d12c6ec60524edb474fb8312c0c6.zip |
wifi: Reset autoscan timer on a new scan
Setting device scanning to false will clean up all networks not
seen so far. If a user scan happens to be requested while the
emulated background scan is running, the background scan will
be cancelled and the non-discovered networks cleared. This causes
unnecessary clearing and re-discovery of WiFi networks when the
user scan is completed.
Create a reset autoscan function that will only reset the autoscan
parameters and not set device scanning to false. Call this function
when starting a scan.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/wifi.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 05b8f5bf..7cd5d816 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -203,7 +203,7 @@ static void remove_networks(struct connman_device *device, wifi->networks = NULL; } -static void stop_autoscan(struct connman_device *device) +static void reset_autoscan(struct connman_device *device) { struct wifi_data *wifi = connman_device_get_data(device); struct autoscan_params *autoscan; @@ -223,11 +223,16 @@ static void stop_autoscan(struct connman_device *device) autoscan->timeout = 0; autoscan->interval = 0; - connman_device_set_scanning(device, FALSE); - connman_device_unref(device); } +static void stop_autoscan(struct connman_device *device) +{ + reset_autoscan(device); + + connman_device_set_scanning(device, FALSE); +} + static void wifi_remove(struct connman_device *device) { struct wifi_data *wifi = connman_device_get_data(device); @@ -812,7 +817,7 @@ static int get_latest_connections(int max_ssids, static int wifi_scan(struct connman_device *device) { - stop_autoscan(device); + reset_autoscan(device); return throw_wifi_scan(device, scan_callback); } @@ -829,8 +834,6 @@ static int wifi_scan_fast(struct connman_device *device) if (wifi->tethering == TRUE) return 0; - stop_autoscan(device); - if (connman_device_get_scanning(device) == TRUE) return -EALREADY; @@ -851,6 +854,8 @@ static int wifi_scan_fast(struct connman_device *device) } connman_device_ref(device); + reset_autoscan(device); + ret = g_supplicant_interface_scan(wifi->interface, scan_params, scan_callback, device); if (ret == 0) @@ -886,8 +891,6 @@ static int wifi_scan_hidden(struct connman_device *device, if (ssid == NULL || ssid_len == 0 || ssid_len > 32) return -EINVAL; - stop_autoscan(device); - if (connman_device_get_scanning(device) == TRUE) return -EALREADY; @@ -920,6 +923,9 @@ static int wifi_scan_hidden(struct connman_device *device, wifi->hidden = hidden; connman_device_ref(device); + + reset_autoscan(device); + ret = g_supplicant_interface_scan(wifi->interface, scan_params, scan_callback, device); if (ret == 0) |