summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2016-11-08 11:37:50 +0100
committerLubomir Rintel <lkundrak@v3.sk>2016-11-08 11:38:46 +0100
commitaf0d9c8a41b84789e0f566a23f71aa86440b4be2 (patch)
tree173c51c0b7c1d9ae2dc51f75740ab480174337d5
parenta4e38cd376e0a0bd1b2241b8cc2173349959012f (diff)
downloadNetworkManager-lr/scanning.tar.gz
wifi: skip the periodic scans when none of the agents need itlr/scanning
The point is to make it possible for the daemon to disable the periodic re-scans that are known to cause latency spikes.
-rw-r--r--src/NetworkManager.ver2
-rw-r--r--src/devices/wifi/nm-device-wifi.c8
2 files changed, 10 insertions, 0 deletions
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;