manager: use nm_device_disconnect_active_connection() in nm_manager_deactivate_connection()

We should not blindly change the device's state. Instead, call
nm_device_disconnect_active_connection() which will figure out whether
the device state needs to change. Note that it is very possible that
the active-connection instance is still queued, not yet queued, or
already disconnected. nm_device_disconnect_active_connection() does
the right thing in all cases.
This commit is contained in:
Thomas Haller 2018-11-20 14:41:14 +01:00
parent a0a36d55a1
commit 023ebd8eeb

View file

@ -5420,10 +5420,10 @@ nm_manager_deactivate_connection (NMManager *manager,
return FALSE;
}
} else {
g_assert (NM_IS_ACT_REQUEST (active));
nm_device_state_changed (nm_active_connection_get_device (active),
NM_DEVICE_STATE_DEACTIVATING,
reason);
nm_assert (NM_IS_ACT_REQUEST (active));
nm_device_disconnect_active_connection (active,
reason,
NM_ACTIVE_CONNECTION_STATE_REASON_UNKNOWN);
}
_notify (manager, PROP_ACTIVE_CONNECTIONS);