[PATCH 2/3] wpa_supplicant: remove pending sme-connect radio work

Ilan Peer ilan.peer at intel.com
Thu Mar 27 02:58:33 EDT 2014


If a new connection is attempted while there is a pending
sme-connection radio work, cancel the pending radio work
and continue with the new connection attempt.

This is preferable over rejecting the new work and
continuing with the pending one, as it is possible that the
previous work is no longer valid.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 wpa_supplicant/sme.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index a860afb..9a0ac91 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -477,8 +477,14 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 	}
 
 	if (radio_work_pending(wpa_s, "sme-connect")) {
-		wpa_dbg(wpa_s, MSG_DEBUG, "SME: Reject sme_authenticate() call since pending work exist");
-		return;
+		/*
+		 * The previous sme-connect work might no longer be valid due to
+		 * the fact that the bss list was updated. In addition, it make
+		 * sense to adhere to the 'newer' decision.
+		 */
+		wpa_dbg(wpa_s, MSG_DEBUG,
+			"SME: Remove previous pending sme-connect");
+		radio_remove_works(wpa_s, "sme-connect", 0);
 	}
 
 	cwork = os_zalloc(sizeof(*cwork));
-- 
1.7.10.4



More information about the HostAP mailing list