This terminates the body of stop_autoscan if autoscan is
not active. Per MEEGO-25987 <http://bugs.meego.com/show_bug.cgi?id=25987>,
running stop_autoscan when changing connected services can prematurely and
incorrectly terminate a new, in-flight service connection and result in a
failure of that connection with "net.connman.Error.OperationAborted:
Operation aborted".
When a scan is started, all networks are marked unavailable. Should the check
added in this patch not be present, device scanning is set to false and all
not yet found networks are removed. Thus the service will not be able to
connect if its network wasn't already found.
static void stop_autoscan(struct connman_device *device)
{
+ const struct wifi_data *wifi = connman_device_get_data(device);
+
+ if (wifi == NULL || wifi->autoscan == NULL)
+ return;
+
reset_autoscan(device);
connman_device_set_scanning(device, FALSE);