From bcba83592e15285fc5e5e126acd9852481cc0772 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 11 May 2011 15:19:32 -0500 Subject: [PATCH] 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. --- src/wimax/nm-device-wimax.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wimax/nm-device-wimax.c b/src/wimax/nm-device-wimax.c index 404d7553a1..9dff503d81 100644 --- a/src/wimax/nm-device-wimax.c +++ b/src/wimax/nm-device-wimax.c @@ -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 */