mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 04:00:09 +01:00
policy: optimize nm_device_can_auto_connect() to not check nm_device_autoconnect_allowed()
This commit is contained in:
parent
45da11f370
commit
bfe66fb8f4
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 (!specific_object || !*specific_object, FALSE);
|
||||
|
||||
if (!nm_device_autoconnect_allowed (self))
|
||||
return FALSE;
|
||||
/* the caller must ensure that nm_device_autoconnect_allowed() returns
|
||||
* 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);
|
||||
if (!nm_setting_connection_get_autoconnect (s_con))
|
||||
|
|
|
|||
|
|
@ -1226,6 +1226,9 @@ auto_activate_device (NMPolicy *self,
|
|||
if (nm_device_get_act_request (device))
|
||||
return;
|
||||
|
||||
if (!nm_device_autoconnect_allowed (device))
|
||||
return;
|
||||
|
||||
connections = nm_manager_get_activatable_connections (priv->manager, &len, TRUE);
|
||||
if (!connections[0])
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue