mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 02:40:17 +01:00
core: optimize generated connection matching a bit
Do a quick check to see if the connetion is compatible with the device before we start doing a relatively heavy connection comparison.
This commit is contained in:
parent
5f15409684
commit
75d694db9b
1 changed files with 13 additions and 9 deletions
|
|
@ -1755,18 +1755,22 @@ get_existing_connection (NMManager *manager, NMDevice *device)
|
|||
for (iter = connections; iter; iter = iter->next) {
|
||||
NMConnection *candidate = NM_CONNECTION (iter->data);
|
||||
|
||||
if (nm_connection_compare (connection, candidate, NM_SETTING_COMPARE_FLAG_INFERRABLE)) {
|
||||
nm_log_info (LOGD_DEVICE, "(%s): found matching connection '%s'",
|
||||
nm_device_get_iface (device),
|
||||
nm_connection_get_id (candidate));
|
||||
g_object_unref (connection);
|
||||
return candidate;
|
||||
}
|
||||
if (!nm_device_check_connection_compatible (device, candidate, NULL))
|
||||
continue;
|
||||
|
||||
if (!nm_connection_compare (connection, candidate, NM_SETTING_COMPARE_FLAG_INFERRABLE))
|
||||
continue;
|
||||
|
||||
nm_log_info (LOGD_DEVICE, "(%s): found matching connection '%s'",
|
||||
nm_device_get_iface (device),
|
||||
nm_connection_get_id (candidate));
|
||||
g_object_unref (connection);
|
||||
return candidate;
|
||||
}
|
||||
|
||||
nm_log_dbg (LOGD_DEVICE, "(%s): generated connection '%s'",
|
||||
nm_device_get_iface (device),
|
||||
nm_connection_get_id (connection));
|
||||
nm_device_get_iface (device),
|
||||
nm_connection_get_id (connection));
|
||||
|
||||
added = nm_settings_add_connection (priv->settings, connection, FALSE, &error);
|
||||
if (!added) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue