manager: reorder conditions in unmanaged_to_disconnected() to check cheaper condition first

Getting nm_device_get_state() is cheap, contrary to nm_device_is_available().
Reorder the checks.
This commit is contained in:
Thomas Haller
2018-02-05 15:01:48 +01:00
parent fc0430b1ab
commit 6075348f0f

View File

@@ -3561,8 +3561,8 @@ unmanaged_to_disconnected (NMDevice *device)
NM_DEVICE_STATE_REASON_USER_REQUESTED); NM_DEVICE_STATE_REASON_USER_REQUESTED);
} }
if ( nm_device_is_available (device, NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST) if ( nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE
&& (nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE)) { && nm_device_is_available (device, NM_DEVICE_CHECK_DEV_AVAILABLE_FOR_USER_REQUEST)) {
nm_device_state_changed (device, nm_device_state_changed (device,
NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_DISCONNECTED,
NM_DEVICE_STATE_REASON_USER_REQUESTED); NM_DEVICE_STATE_REASON_USER_REQUESTED);