From 61e516bc203722efdad3a041d2f460b7b9c4eef0 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 22 Oct 2020 16:31:57 +0200 Subject: [PATCH] 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. --- src/devices/wifi/nm-device-iwd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index b11a272e81..e766238121 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -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); }