From f0147a9c476e49aad373591f7ef1029b683cd560 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 24 Nov 2017 12:59:15 +0100 Subject: [PATCH] policy: avoid false positives for checking for autoactivation We want to only check for autoconnect all, if something happend that makes it possible that we can autoconnect now (while we couldn't previously). It's not a real problem to check more often then strictly necessary. But add a check to rule out a few false-positives to avoid the overhead of checking all devices for autoconnect. --- src/nm-policy.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/nm-policy.c b/src/nm-policy.c index 81d4db937..d04727dae 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1430,7 +1430,8 @@ reset_autoconnect_all (NMPolicy *self, /* maybe the connection is still blocked afterwards for other reasons * and in the larger picture nothing changed. But it's too complicated * to find out exactly. Just assume, something changed to be sure. */ - changed = TRUE; + if (!nm_settings_connection_autoconnect_is_blocked (connection)) + changed = TRUE; } } else { /* we reset the tries-count and any blocked-reason */ @@ -1441,8 +1442,10 @@ reset_autoconnect_all (NMPolicy *self, if (nm_settings_connection_autoconnect_blocked_reason_set (connection, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_ALL & ~NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST, - FALSE)) - changed = TRUE; + FALSE)) { + if (!nm_settings_connection_autoconnect_is_blocked (connection)) + changed = TRUE; + } } } return changed; @@ -1615,8 +1618,10 @@ activate_slave_connections (NMPolicy *self, NMDevice *device) } if (nm_settings_connection_autoconnect_blocked_reason_set (connection, NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_FAILED, - FALSE)) - changed = TRUE; + FALSE)) { + if (!nm_settings_connection_autoconnect_is_blocked (connection)) + changed = TRUE; + } } if (changed)