[RFC] wpa_supplicant: Don't terminate until all wps callbacks complete.

Ben Greear greearb
Wed Feb 16 13:21:57 PST 2011


I'm not sure this fixes any real problem, but seems cleaner.

Signed-off-by: Ben Greear <greearb at candelatech.com>
---
:100644 100644 8100f1c... bef1a5a... M	wpa_supplicant/wps_supplicant.c
 wpa_supplicant/wps_supplicant.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 8100f1c..bef1a5a 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -1542,11 +1542,12 @@ int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
 			     os_strlen(pin), &cred);
 }
 
-
+static int callbacks_pending = 0;
 static void wpas_wps_terminate_cb(void *ctx)
 {
 	wpa_printf(MSG_DEBUG, "WPS ER: Terminated");
-	eloop_terminate();
+	if (--callbacks_pending <= 0)
+		eloop_terminate();
 }
 #endif /* CONFIG_WPS_ER */
 
@@ -1555,6 +1556,7 @@ int wpas_wps_terminate_pending(struct wpa_supplicant *wpa_s)
 {
 #ifdef CONFIG_WPS_ER
 	if (wpa_s->wps_er) {
+		callbacks_pending++;
 		wps_er_deinit(wpa_s->wps_er, wpas_wps_terminate_cb, wpa_s);
 		wpa_s->wps_er = NULL;
 		return 1;
-- 
1.7.2.3




More information about the Hostap mailing list