diff options
author | Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> | 2012-05-25 11:17:41 +0300 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-05-25 14:54:37 +0300 |
commit | bb163c7901093a4779dafd61d194627caabbdbc2 (patch) | |
tree | d46560ae01061dfde7c471033494885e889b6ef4 /plugins | |
parent | 69555972726e279f1f727fa1fd54ea219b78f113 (diff) | |
download | connman-bb163c7901093a4779dafd61d194627caabbdbc2.tar.gz connman-bb163c7901093a4779dafd61d194627caabbdbc2.tar.bz2 connman-bb163c7901093a4779dafd61d194627caabbdbc2.zip |
wifi: Check device is not already scanning before a new scan.
gsupplicant's interface scanning value is slow to be updated since it's wpa_s event
which updates it, thus leading to a time gap where it is possible to request another scan.
It will therefore reference once again device, which will lead to too many references hold
by wifi plugin
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/wifi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index ee114133..09d7ab4c 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -405,6 +405,9 @@ static int throw_wifi_scan(struct connman_device *device, if (wifi->tethering == TRUE) return 0; + if (connman_device_get_scanning(device) == TRUE) + return -EALREADY; + connman_device_ref(device); ret = g_supplicant_interface_scan(wifi->interface, NULL, @@ -822,6 +825,9 @@ static int wifi_scan_fast(struct connman_device *device) if (wifi->tethering == TRUE) return 0; + if (connman_device_get_scanning(device) == TRUE) + return -EALREADY; + driver_max_ssids = g_supplicant_interface_get_max_scan_ssids( wifi->interface); DBG("max ssids %d", driver_max_ssids); @@ -875,6 +881,9 @@ static int wifi_scan_hidden(struct connman_device *device, if (ssid == NULL || ssid_len == 0 || ssid_len > 32) return -EINVAL; + if (connman_device_get_scanning(device) == TRUE) + return -EALREADY; + scan_params = g_try_malloc0(sizeof(GSupplicantScanParams)); if (scan_params == NULL) return -ENOMEM; |