mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 10:00:07 +01:00
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 (?).
(cherry picked from commit c2c68ce169)
This commit is contained in:
parent
2a3b3ca38d
commit
f533ce5b95
1 changed files with 17 additions and 15 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue