wimax: fix disconnect conditions

Only fail an activated device if it's actually activated, and
only fail an activating device if the timeout triggers or if
the connect callback indicates failure, not based on device state.
This commit is contained in:
Dan Williams 2011-01-04 18:50:48 -06:00
parent 597c2aeb80
commit 568f11ee54

View file

@ -674,7 +674,7 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
return;
}
if (priv->connect_failed || new_status < WIMAX_API_DEVICE_STATUS_Connecting) {
if (priv->connect_failed) {
/* Connection attempt failed */
nm_log_info (LOGD_WIMAX, "(%s): connection to '%s' failed: (%d) %s",
iface, nsp_name, reason, iwmx_sdk_reason_to_str (reason));
@ -686,15 +686,17 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
}
/* Handle disconnection */
if ( old_status == WIMAX_API_DEVICE_STATUS_Data_Connected
&& new_status < WIMAX_API_DEVICE_STATUS_Connecting) {
if (state == NM_DEVICE_STATE_ACTIVATED) {
if ( old_status == WIMAX_API_DEVICE_STATUS_Data_Connected
&& new_status < WIMAX_API_DEVICE_STATUS_Connecting) {
nm_log_info (LOGD_WIMAX, "(%s): disconnected from '%s': (%d) %s",
iface, nsp_name, reason, iwmx_sdk_reason_to_str (reason));
nm_log_info (LOGD_WIMAX, "(%s): disconnected from '%s': (%d) %s",
iface, nsp_name, reason, iwmx_sdk_reason_to_str (reason));
nm_device_state_changed (NM_DEVICE (self),
NM_DEVICE_STATE_FAILED,
NM_DEVICE_STATE_REASON_CONFIG_FAILED);
nm_device_state_changed (NM_DEVICE (self),
NM_DEVICE_STATE_FAILED,
NM_DEVICE_STATE_REASON_CONFIG_FAILED);
}
}
}