From af0d9c8a41b84789e0f566a23f71aa86440b4be2 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 8 Nov 2016 11:37:50 +0100 Subject: wifi: skip the periodic scans when none of the agents need it The point is to make it possible for the daemon to disable the periodic re-scans that are known to cause latency spikes. --- src/NetworkManager.ver | 2 ++ src/devices/wifi/nm-device-wifi.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/NetworkManager.ver b/src/NetworkManager.ver index 9e613d4142..82f193ec34 100644 --- a/src/NetworkManager.ver +++ b/src/NetworkManager.ver @@ -25,6 +25,8 @@ global: nm_active_connection_get_specific_object; nm_active_connection_get_type; nm_active_connection_set_specific_object; + nm_agent_manager_get; + nm_agent_manager_exists_agent_without_capability; nm_config_data_get_connection_default; nm_config_data_get_device_config; nm_config_data_get_device_config_boolean; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 8381aaccb3..b34d021ead 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -50,6 +50,7 @@ #include "nm-settings.h" #include "nm-core-internal.h" #include "nm-config.h" +#include "nm-agent-manager.h" #include "nmdbus-device-wifi.h" @@ -1442,6 +1443,13 @@ request_wireless_scan_periodic (gpointer user_data) NMDeviceWifi *self = user_data; NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); + if ( nm_device_get_state (NM_DEVICE (self)) == NM_DEVICE_STATE_ACTIVATED + && !nm_agent_manager_exists_agent_without_capability (nm_agent_manager_get (), + NM_SECRET_AGENT_CAPABILITY_WIFI_SCAN)) { + /* Don't trigger the scan now, no agents need it. */ + return G_SOURCE_CONTINUE; + } + priv->pending_scan_id = 0; request_wireless_scan (self, NULL); return G_SOURCE_REMOVE; -- cgit v1.2.1