summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-03-29 16:47:05 +0200
committerThomas Haller <thaller@redhat.com>2018-04-13 09:09:46 +0200
commitebd53888b6d2c2890f68e0013e15c46cd1239577 (patch)
treefaa60ad15c00ea643f519d6a059c2a23d4978695
parentdcbb5c07e1d4aef1e7653d620eba474b5aba2c24 (diff)
core: avoid unnecessary action in NMPolicy's _deactivate_if_active()
We only need @state, after we verified that the active connection references the right settings connection. Most of the time, that is not the case.
-rw-r--r--src/nm-policy.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 61efee556b..9f845c1b0e 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -2321,10 +2321,9 @@ _deactivate_if_active (NMPolicy *self, NMSettingsConnection *connection)
nm_assert (NM_IS_SETTINGS_CONNECTION (connection));
nm_manager_for_each_active_connection (priv->manager, ac, tmp_list) {
- NMActiveConnectionState state = nm_active_connection_get_state (ac);
if ( nm_active_connection_get_settings_connection (ac) == connection
- && (state <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) {
+ && (nm_active_connection_get_state (ac) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) {
if (!nm_manager_deactivate_connection (priv->manager,
ac,
NM_DEVICE_STATE_REASON_CONNECTION_REMOVED,