]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS ER: Stop eloop only on the last terminate_cb
authorBen Greear <greearb@candelatech.com>
Mon, 21 Feb 2011 19:47:46 +0000 (21:47 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 21 Feb 2011 19:47:46 +0000 (21:47 +0200)
This allows all WPS ER instances to be cleaned up properly if more
than one interface has an active WPS ER when wpa_supplicant is being
killed.

wpa_supplicant/wps_supplicant.c

index 8100f1cc1b8d93bdfbae5bb0ef57c90efadc5eab..d39d2cd714332a8a6ed1ccf9e53b8cb8e9e0ad15 100644 (file)
@@ -1543,10 +1543,13 @@ int wpas_wps_er_config(struct wpa_supplicant *wpa_s, const char *uuid,
 }
 
 
+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 +1558,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;