wimax: make sure current NSP is cleared when appropriate

When removing all NSPs in the scan list clearly we should be clearing
out the current NSP as well, since it just got removed from the scan
list.  And make sure the current NSP is cleared when activation fails
or when the device becomes disconnected, since it's not connected to
anything and thus can't have a current NSP either.

The current NSP should only be set during the activation attempt and
while the device is connected.
This commit is contained in:
Dan Williams 2011-05-11 15:19:32 -05:00
parent f74c9ebe8f
commit bcba83592e

View file

@ -278,6 +278,8 @@ remove_all_nsps (NMDeviceWimax *self)
{
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
set_current_nsp (self, NULL);
while (g_slist_length (priv->nsp_list)) {
NMWimaxNsp *nsp = NM_WIMAX_NSP (priv->nsp_list->data);
@ -1278,15 +1280,17 @@ device_state_changed (NMDevice *device,
if (new_state < NM_DEVICE_STATE_DISCONNECTED)
remove_all_nsps (self);
/* Request initial NSP list */
/* Request initial NSP list when device is first started */
if ( new_state == NM_DEVICE_STATE_DISCONNECTED
&& old_state < NM_DEVICE_STATE_DISCONNECTED) {
if (priv->sdk)
iwmx_sdk_get_networks (priv->sdk);
}
if (new_state == NM_DEVICE_STATE_FAILED || new_state <= NM_DEVICE_STATE_DISCONNECTED)
if (new_state == NM_DEVICE_STATE_FAILED || new_state <= NM_DEVICE_STATE_DISCONNECTED) {
set_current_nsp (self, NULL);
clear_activation_timeout (self);
}
if (new_state == NM_DEVICE_STATE_ACTIVATED) {
/* poll link quality and BSID */