mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 03:30:09 +01:00
vpn: make nm_vpn_manager_deactivate_connection() take an object, not a path
Pointless to look up the object by its path when we already have the object.
This commit is contained in:
parent
1b968f4021
commit
1fcb577e19
3 changed files with 7 additions and 9 deletions
|
|
@ -3014,7 +3014,7 @@ nm_manager_deactivate_connection (NMManager *manager,
|
|||
|
||||
if (reason == NM_DEVICE_STATE_REASON_CONNECTION_REMOVED)
|
||||
vpn_reason = NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED;
|
||||
if (nm_vpn_manager_deactivate_connection (priv->vpn_manager, connection_path, vpn_reason))
|
||||
if (nm_vpn_manager_deactivate_connection (priv->vpn_manager, NM_VPN_CONNECTION (active), vpn_reason))
|
||||
success = TRUE;
|
||||
} else {
|
||||
g_assert (NM_IS_ACT_REQUEST (active));
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ nm_vpn_manager_activate_connection (NMVPNManager *manager,
|
|||
|
||||
gboolean
|
||||
nm_vpn_manager_deactivate_connection (NMVPNManager *self,
|
||||
const char *path,
|
||||
NMVPNConnection *connection,
|
||||
NMVPNConnectionStateReason reason)
|
||||
{
|
||||
NMVPNManagerPrivate *priv;
|
||||
|
|
@ -179,19 +179,17 @@ nm_vpn_manager_deactivate_connection (NMVPNManager *self,
|
|||
|
||||
g_return_val_if_fail (self, FALSE);
|
||||
g_return_val_if_fail (NM_IS_VPN_MANAGER (self), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
g_return_val_if_fail (connection != NULL, FALSE);
|
||||
|
||||
priv = NM_VPN_MANAGER_GET_PRIVATE (self);
|
||||
g_hash_table_iter_init (&iter, priv->services);
|
||||
while (g_hash_table_iter_next (&iter, NULL, &data) && (success == FALSE)) {
|
||||
active = nm_vpn_service_get_active_connections (NM_VPN_SERVICE (data));
|
||||
for (aiter = active; aiter; aiter = g_slist_next (aiter)) {
|
||||
NMVPNConnection *vpn = NM_VPN_CONNECTION (aiter->data);
|
||||
const char *vpn_path;
|
||||
NMVPNConnection *candidate = aiter->data;
|
||||
|
||||
vpn_path = nm_active_connection_get_path (NM_ACTIVE_CONNECTION (vpn));
|
||||
if (!strcmp (path, vpn_path)) {
|
||||
nm_vpn_connection_disconnect (vpn, reason);
|
||||
if (connection == candidate) {
|
||||
nm_vpn_connection_disconnect (connection, reason);
|
||||
success = TRUE;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ NMActiveConnection *nm_vpn_manager_activate_connection (NMVPNManager *manager,
|
|||
GError **error);
|
||||
|
||||
gboolean nm_vpn_manager_deactivate_connection (NMVPNManager *manager,
|
||||
const char *path,
|
||||
NMVPNConnection *connection,
|
||||
NMVPNConnectionStateReason reason);
|
||||
|
||||
#endif /* NM_VPN_MANAGER_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue