mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
policy: optimize nm_device_can_auto_connect() to not check nm_device_autoconnect_allowed()
(cherry picked from commit bfe66fb8f4)
This commit is contained in:
parent
f77b48a59a
commit
baa0d95c95
2 changed files with 11 additions and 2 deletions
|
|
@ -4372,8 +4372,14 @@ nm_device_can_auto_connect (NMDevice *self,
|
||||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
||||||
g_return_val_if_fail (!specific_object || !*specific_object, FALSE);
|
g_return_val_if_fail (!specific_object || !*specific_object, FALSE);
|
||||||
|
|
||||||
if (!nm_device_autoconnect_allowed (self))
|
/* the caller must ensure that nm_device_autoconnect_allowed() returns
|
||||||
return FALSE;
|
* TRUE as well. This is done, because nm_device_can_auto_connect()
|
||||||
|
* has only one caller, and it iterates over a list of available
|
||||||
|
* connections.
|
||||||
|
*
|
||||||
|
* Hence, we don't need to re-check nm_device_autoconnect_allowed()
|
||||||
|
* over and over again. The caller is supposed to do that. */
|
||||||
|
nm_assert (nm_device_autoconnect_allowed (self));
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
s_con = nm_connection_get_setting_connection (connection);
|
||||||
if (!nm_setting_connection_get_autoconnect (s_con))
|
if (!nm_setting_connection_get_autoconnect (s_con))
|
||||||
|
|
|
||||||
|
|
@ -1226,6 +1226,9 @@ auto_activate_device (NMPolicy *self,
|
||||||
if (nm_device_get_act_request (device))
|
if (nm_device_get_act_request (device))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!nm_device_autoconnect_allowed (device))
|
||||||
|
return;
|
||||||
|
|
||||||
connections = nm_manager_get_activatable_connections (priv->manager, &len, TRUE);
|
connections = nm_manager_get_activatable_connections (priv->manager, &len, TRUE);
|
||||||
if (!connections[0])
|
if (!connections[0])
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue