core: avoid creating devcon data that we don't need

Otherwise, we create device × profiles entries, most of
them nonsensical.
This commit is contained in:
Thomas Haller 2023-04-28 11:47:20 +02:00
parent 87b46e1663
commit a019d965f7
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 15 additions and 6 deletions

View file

@ -1456,7 +1456,11 @@ nm_manager_devcon_autoconnect_retries_blocked_until(NMManager *self,
nm_assert(NM_IS_SETTINGS_CONNECTION(sett_conn));
if (device) {
data = _devcon_lookup_data(self, device, sett_conn, TRUE, TRUE);
data = _devcon_lookup_data(self, device, sett_conn, FALSE, FALSE);
if (!data)
return 0;
return data->autoconnect.blocked_until_sec;
}
@ -1487,7 +1491,10 @@ nm_manager_devcon_autoconnect_is_blocked(NMManager *self,
if (nm_settings_connection_autoconnect_is_blocked(sett_conn))
return TRUE;
data = _devcon_lookup_data(self, device, sett_conn, TRUE, TRUE);
data = _devcon_lookup_data(self, device, sett_conn, FALSE, FALSE);
if (!data)
return FALSE;
if (data->autoconnect.blocked_reason != NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_NONE)
return TRUE;

View file

@ -1758,11 +1758,13 @@ _connection_autoconnect_retries_set(NMPolicy *self,
if (tries == 0) {
/* Schedule a handler to reset retries count */
if (!priv->reset_connections_retries_idle_source) {
gint32 retry_time = nm_manager_devcon_autoconnect_retries_blocked_until(priv->manager,
device,
connection);
gint32 retry_time;
retry_time = nm_manager_devcon_autoconnect_retries_blocked_until(priv->manager,
device,
connection);
nm_assert(retry_time != 0);
g_warn_if_fail(retry_time != 0);
priv->reset_connections_retries_idle_source = nm_g_timeout_add_seconds_source(
MAX(0, retry_time - nm_utils_get_monotonic_timestamp_sec()),
reset_connections_retries,