iwd: Move scheduling periodic scan out of set_current_ap()

set_current_ap() would always call schedule_periodic_scan() but: first it
would do nothing when current_ap was non-NULL because we
schedule_periodic_scan makes sure not to auto-scan when connected.
Secondly state_changed() already calls schedule_periodic_scan
indirectly through set_can_scan() so normally when we disconnect and
current_ap becomes NULL we already do trigger a scan.  The only
situation where we didn't is when a connection is cancelled during
NEED_AUTH because IWD's state doesn't change, so we add a
schedule_periodic_scan() call in network_connect_cb() on error.
This commit is contained in:
Andrew Zaborowski 2020-10-22 16:31:57 +02:00 committed by Thomas Haller
parent 221c8d75f3
commit 61e516bc20
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -169,7 +169,6 @@ set_current_ap(NMDeviceIwd *self, NMWifiAP *new_ap, gboolean recheck_available_c
memset(priv->current_ap_bssid, 0, ETH_ALEN);
_notify(self, PROP_ACTIVE_ACCESS_POINT);
_notify(self, PROP_MODE);
schedule_periodic_scan(self, TRUE);
}
static void
@ -1524,9 +1523,13 @@ failed:
nm_device_queue_state(device, NM_DEVICE_STATE_FAILED, reason);
value = g_dbus_proxy_get_cached_property(priv->dbus_station_proxy, "State");
if (!priv->nm_autoconnect && nm_streq(get_variant_state(value), "disconnected")) {
priv->nm_autoconnect = true;
nm_device_emit_recheck_auto_activate(device);
if (nm_streq(get_variant_state(value), "disconnected")) {
schedule_periodic_scan(self, TRUE);
if (!priv->nm_autoconnect) {
priv->nm_autoconnect = true;
nm_device_emit_recheck_auto_activate(device);
}
}
g_variant_unref(value);
}