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:
Dan Winship 2014-01-03 13:58:05 -05:00
parent eceb613f4c
commit c4fc72c795
2 changed files with 5 additions and 3 deletions

View file

@ -4618,7 +4618,7 @@ disconnect_cb (NMDevice *device,
TRUE);
nm_device_state_changed (device,
NM_DEVICE_STATE_DISCONNECTED,
NM_DEVICE_STATE_DEACTIVATING,
NM_DEVICE_STATE_REASON_USER_REQUESTED);
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);
}
break;
case NM_DEVICE_STATE_DEACTIVATING:
nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, reason);
break;
case NM_DEVICE_STATE_DISCONNECTED:
if (old_state > NM_DEVICE_STATE_DISCONNECTED && priv->default_unmanaged)
nm_device_queue_state (device, NM_DEVICE_STATE_UNMANAGED, NM_DEVICE_STATE_REASON_NONE);

View file

@ -3489,9 +3489,8 @@ nm_manager_deactivate_connection (NMManager *manager,
"The VPN connection was not active.");
} else {
g_assert (NM_IS_ACT_REQUEST (active));
/* FIXME: use DEACTIVATING state */
nm_device_state_changed (nm_active_connection_get_device (active),
NM_DEVICE_STATE_DISCONNECTED,
NM_DEVICE_STATE_DEACTIVATING,
reason);
success = TRUE;
}