mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 19:28:04 +02: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.
(cherry picked from commit 3706fd17eb)
This commit is contained in:
parent
0d0b778c29
commit
359e52651b
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);
|
update_agent_secrets_cache (self, info->new_settings);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (info->new_settings) {
|
||||||
if (nm_audit_manager_audit_enabled (nm_audit_manager_get ())) {
|
if (nm_audit_manager_audit_enabled (nm_audit_manager_get ())) {
|
||||||
gs_unref_hashtable GHashTable *diff = NULL;
|
gs_unref_hashtable GHashTable *diff = NULL;
|
||||||
gboolean same;
|
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 (info->new_settings) {
|
||||||
if (!nm_settings_connection_replace_settings_prepare (self,
|
if (!nm_settings_connection_replace_settings_prepare (self,
|
||||||
info->new_settings,
|
info->new_settings,
|
||||||
|
|
@ -1748,16 +1739,29 @@ update_auth_cb (NMSettingsConnection *self,
|
||||||
goto out;
|
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;
|
commit_reason = NM_SETTINGS_CONNECTION_COMMIT_REASON_USER_ACTION;
|
||||||
if ( info->new_settings
|
if ( info->new_settings
|
||||||
&& !nm_streq0 (nm_connection_get_id (NM_CONNECTION (self)),
|
&& !nm_streq0 (nm_connection_get_id (NM_CONNECTION (self)),
|
||||||
nm_connection_get_id (info->new_settings)))
|
nm_connection_get_id (info->new_settings)))
|
||||||
commit_reason |= NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED;
|
commit_reason |= NM_SETTINGS_CONNECTION_COMMIT_REASON_ID_CHANGED;
|
||||||
|
|
||||||
nm_settings_connection_commit_changes (self,
|
_commit_changes_full (self,
|
||||||
info->new_settings,
|
info->new_settings,
|
||||||
commit_reason,
|
FALSE,
|
||||||
&local);
|
commit_reason,
|
||||||
|
&local);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (!local) {
|
if (!local) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue