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.
This commit is contained in:
Thomas Haller
2017-11-24 12:59:15 +01:00
parent 36ac08c092
commit f0147a9c47

View File

@@ -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)