mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-09 14:40:21 +01:00
wireguard: refactor cleanup of NMDeviceWireGuard on disconnect/dispose
This commit is contained in:
parent
9d88f0d73f
commit
79f6d4ad18
1 changed files with 11 additions and 10 deletions
|
|
@ -1405,21 +1405,25 @@ get_configured_mtu (NMDevice *device, NMDeviceMtuSource *out_source)
|
|||
out_source);
|
||||
}
|
||||
|
||||
static void
|
||||
_device_cleanup (NMDeviceWireGuard *self)
|
||||
{
|
||||
NMDeviceWireGuardPrivate *priv = NM_DEVICE_WIREGUARD_GET_PRIVATE (self);
|
||||
|
||||
_peers_remove_all (priv);
|
||||
_secrets_cancel (self);
|
||||
}
|
||||
|
||||
static void
|
||||
device_state_changed (NMDevice *device,
|
||||
NMDeviceState new_state,
|
||||
NMDeviceState old_state,
|
||||
NMDeviceStateReason reason)
|
||||
{
|
||||
NMDeviceWireGuardPrivate *priv;
|
||||
|
||||
if (new_state <= NM_DEVICE_STATE_ACTIVATED)
|
||||
return;
|
||||
|
||||
priv = NM_DEVICE_WIREGUARD_GET_PRIVATE (device);
|
||||
|
||||
_peers_remove_all (priv);
|
||||
_secrets_cancel (NM_DEVICE_WIREGUARD (device));
|
||||
_device_cleanup (NM_DEVICE_WIREGUARD (device));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -1567,11 +1571,8 @@ static void
|
|||
dispose (GObject *object)
|
||||
{
|
||||
NMDeviceWireGuard *self = NM_DEVICE_WIREGUARD (object);
|
||||
NMDeviceWireGuardPrivate *priv = NM_DEVICE_WIREGUARD_GET_PRIVATE (self);
|
||||
|
||||
_secrets_cancel (self);
|
||||
|
||||
_peers_remove_all (priv);
|
||||
_device_cleanup (self);
|
||||
|
||||
G_OBJECT_CLASS (nm_device_wireguard_parent_class)->dispose (object);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue