summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Zaborowski <andrew.zaborowski@intel.com>2020-10-06 02:23:03 +0200
committerThomas Haller <thaller@redhat.com>2020-10-06 14:13:14 +0200
commitc2c68ce16992d48ded27f5f1d7fb024243944f7e (patch)
tree3d576d25951e25825ad65908e2d5378b957db09b
parentd2b0c5af6378adbb0fb3c47fea41d2ddd17a6a50 (diff)
downloadNetworkManager-c2c68ce16992d48ded27f5f1d7fb024243944f7e.tar.gz
iwd: Disable periodic scanning when connected
The automatic scanning every 20 seconds while connected has been annoying users because of the extra connection latency, drop it. The UIs are supposed to be requesting scans whenever an AP list update is needed (?).
-rw-r--r--src/devices/wifi/nm-device-iwd.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c
index 4ec3e1cc7b..64ac3de7e6 100644
--- a/src/devices/wifi/nm-device-iwd.c
+++ b/src/devices/wifi/nm-device-iwd.c
@@ -1952,36 +1952,39 @@ schedule_periodic_scan(NMDeviceIwd *self, gboolean initial_scan)
{
NMDeviceIwdPrivate *priv = NM_DEVICE_IWD_GET_PRIVATE(self);
GVariant * value;
- gboolean disconnected;
+ gboolean disconnected = TRUE;
guint interval;
- if (!priv->can_scan || priv->scan_requested)
- return;
-
- value = g_dbus_proxy_get_cached_property(priv->dbus_station_proxy, "State");
- disconnected = nm_streq0(get_variant_state(value), "disconnected");
- g_variant_unref(value);
+ if (priv->can_scan) {
+ value = g_dbus_proxy_get_cached_property(priv->dbus_station_proxy, "State");
+ disconnected = nm_streq0(get_variant_state(value), "disconnected");
+ g_variant_unref(value);
+ }
/* Start scan immediately after a disconnect, mode change or
- * device UP, otherwise wait a period dependent on the current
- * state.
+ * device UP, otherwise wait 10 seconds. When connected, update
+ * AP list mainly on UI requests.
*
* (initial_scan && disconnected) override priv->scanning below
* because of an IWD quirk where a device will often be in the
* autoconnect state and scanning at the time of our initial_scan,
- * but our logic will the send it a Disconnect() causing IWD to
+ * but our logic will then send it a Disconnect() causing IWD to
* exit autoconnect and interrupt the ongoing scan, meaning that
* we still want a new scan ASAP.
*/
- if (initial_scan && disconnected)
+ if (!priv->can_scan || !disconnected || priv->scan_requested || priv->scanning)
+ interval = -1;
+ else if (initial_scan)
interval = 0;
- else if (!priv->periodic_scan_id && !priv->scanning)
- interval = disconnected ? 10 : 20;
+ else if (!priv->periodic_scan_id)
+ interval = 10;
else
return;
nm_clear_g_source(&priv->periodic_scan_id);
- priv->periodic_scan_id = g_timeout_add_seconds(interval, periodic_scan_timeout_cb, self);
+
+ if (interval != (guint) -1)
+ priv->periodic_scan_id = g_timeout_add_seconds(interval, periodic_scan_timeout_cb, self);
}
static void
@@ -2384,7 +2387,6 @@ powered_changed(NMDeviceIwd *self, gboolean new_powered)
update_aps(self);
} else {
set_can_scan(self, FALSE);
- nm_clear_g_source(&priv->periodic_scan_id);
priv->scanning = FALSE;
priv->scan_requested = FALSE;
priv->can_connect = FALSE;