mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 05:10:09 +01:00
settings: refactor update_auth_cb() and prepare connection once
Note how nm_settings_connection_commit_changes() would call prepare() a second time. Don't do that. Also, move the prepare step earlier, and call _replace_settings_full() without preparing the new connection again.
This commit is contained in:
parent
75f787d1da
commit
3706fd17eb
1 changed files with 19 additions and 15 deletions
|
|
@ -1716,7 +1716,9 @@ update_auth_cb (NMSettingsConnection *self,
|
|||
*/
|
||||
update_agent_secrets_cache (self, info->new_settings);
|
||||
}
|
||||
}
|
||||
|
||||
if (info->new_settings) {
|
||||
if (nm_audit_manager_audit_enabled (nm_audit_manager_get ())) {
|
||||
gs_unref_hashtable GHashTable *diff = NULL;
|
||||
gboolean same;
|
||||
|
|
@ -1730,17 +1732,6 @@ update_auth_cb (NMSettingsConnection *self,
|
|||
}
|
||||
}
|
||||
|
||||
if (!info->save_to_disk) {
|
||||
if (info->new_settings) {
|
||||
nm_settings_connection_replace_settings (self,
|
||||
info->new_settings,
|
||||
NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY,
|
||||
"replace-unsaved",
|
||||
&local);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (info->new_settings) {
|
||||
if (!nm_settings_connection_replace_settings_prepare (self,
|
||||
info->new_settings,
|
||||
|
|
@ -1748,16 +1739,29 @@ update_auth_cb (NMSettingsConnection *self,
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (!info->save_to_disk) {
|
||||
if (info->new_settings) {
|
||||
_replace_settings_full (self,
|
||||
info->new_settings,
|
||||
FALSE,
|
||||
NM_SETTINGS_CONNECTION_PERSIST_MODE_IN_MEMORY,
|
||||
"replace-unsaved",
|
||||
&local);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
commit_reason = NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION;
|
||||
if ( info->new_settings
|
||||
&& !nm_streq0 (nm_connection_get_id (NM_CONNECTION (self)),
|
||||
nm_connection_get_id (info->new_settings)))
|
||||
commit_reason |= NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED;
|
||||
|
||||
nm_settings_connection_commit_changes (self,
|
||||
info->new_settings,
|
||||
commit_reason,
|
||||
&local);
|
||||
_commit_changes_full (self,
|
||||
info->new_settings,
|
||||
FALSE,
|
||||
commit_reason,
|
||||
&local);
|
||||
|
||||
out:
|
||||
if (!local) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue