devices: start using the DEACTIVATING state
When a device is disconnected by the user (as opposed to due to network or hardware error, etc), set it first to DEACTIVATING, which does nothing but queue a transition to disconnected. This lets other parts of NM observe the device when it is about-to-disconnect, but still has an associated connection.
This commit is contained in:
@@ -4618,7 +4618,7 @@ disconnect_cb (NMDevice *device,
|
|||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
nm_device_state_changed (device,
|
nm_device_state_changed (device,
|
||||||
NM_DEVICE_STATE_DISCONNECTED,
|
NM_DEVICE_STATE_DEACTIVATING,
|
||||||
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
NM_DEVICE_STATE_REASON_USER_REQUESTED);
|
||||||
dbus_g_method_return (context);
|
dbus_g_method_return (context);
|
||||||
}
|
}
|
||||||
@@ -6304,6 +6304,9 @@ nm_device_state_changed (NMDevice *device,
|
|||||||
nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
|
nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NM_DEVICE_STATE_DEACTIVATING:
|
||||||
|
nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, reason);
|
||||||
|
break;
|
||||||
case NM_DEVICE_STATE_DISCONNECTED:
|
case NM_DEVICE_STATE_DISCONNECTED:
|
||||||
if (old_state > NM_DEVICE_STATE_DISCONNECTED && priv->default_unmanaged)
|
if (old_state > NM_DEVICE_STATE_DISCONNECTED && priv->default_unmanaged)
|
||||||
nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
|
nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);
|
||||||
|
@@ -3489,9 +3489,8 @@ nm_manager_deactivate_connection (NMManager *manager,
|
|||||||
"The VPN connection was not active.");
|
"The VPN connection was not active.");
|
||||||
} else {
|
} else {
|
||||||
g_assert (NM_IS_ACT_REQUEST (active));
|
g_assert (NM_IS_ACT_REQUEST (active));
|
||||||
/* FIXME: use DEACTIVATING state */
|
|
||||||
nm_device_state_changed (nm_active_connection_get_device (active),
|
nm_device_state_changed (nm_active_connection_get_device (active),
|
||||||
NM_DEVICE_STATE_DISCONNECTED,
|
NM_DEVICE_STATE_DEACTIVATING,
|
||||||
reason);
|
reason);
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user