From a27cd8e5d95e4f5a1c54d6dc2515feb2bb861444 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 29 Jun 2011 18:15:05 -0500 Subject: [PATCH] wifi: allow supplicant disconnect request more often Use a broader range of supplicant interface states to determine when to tell the supplicant to idle; we want to allow the disconnect in all of these states, not just some of them. Second, allow the active network to be removed from the supplicant's list in most of these states, even when the supplicant interface is inactive or disconnected. --- .../nm-supplicant-interface.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c index e9e58f39fe..2459f589ae 100644 --- a/src/supplicant-manager/nm-supplicant-interface.c +++ b/src/supplicant-manager/nm-supplicant-interface.c @@ -682,12 +682,13 @@ nm_supplicant_interface_disconnect (NMSupplicantInterface * self) if (!priv->iface_proxy) return; - /* Don't try to disconnect if the supplicant interface is already disconnected */ - if ( priv->state == NM_SUPPLICANT_INTERFACE_STATE_DISCONNECTED - || priv->state == NM_SUPPLICANT_INTERFACE_STATE_INACTIVE) { - g_free (priv->net_path); - priv->net_path = NULL; - return; + /* Disconnect from the current AP */ + if ( (priv->state >= NM_SUPPLICANT_INTERFACE_STATE_SCANNING) + && (priv->state <= NM_SUPPLICANT_INTERFACE_STATE_COMPLETED)) { + dbus_g_proxy_begin_call (priv->iface_proxy, "Disconnect", + disconnect_cb, + NULL, NULL, + G_TYPE_INVALID); } /* Remove any network that was added by NetworkManager */ @@ -700,11 +701,6 @@ nm_supplicant_interface_disconnect (NMSupplicantInterface * self) g_free (priv->net_path); priv->net_path = NULL; } - - dbus_g_proxy_begin_call (priv->iface_proxy, "Disconnect", - disconnect_cb, - NULL, NULL, - G_TYPE_INVALID); } static void