From 2bb747e2321e4dbd452c34a1e2c4160d884f115f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 17 Nov 2011 16:21:11 +0200 Subject: [PATCH] P2P: Cancel previous operation before starting new p2p_listen Some drivers do not handle concurrent remain-on-channel operation requests, so run p2p_stop_find() prior to starting p2p_listen. This addresses some issues with P2P_LISTEN command being issues again while already in Listen state. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index a2b3f0654..d2668be7d 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3399,6 +3399,14 @@ int wpas_p2p_listen(struct wpa_supplicant *wpa_s, unsigned int timeout) eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL); wpa_s->p2p_long_listen = 0; + /* + * Stop previous find/listen operation to avoid trying to request a new + * remain-on-channel operation while the driver is still running the + * previous one. + */ + if (wpa_s->global->p2p) + p2p_stop_find(wpa_s->global->p2p); + res = wpas_p2p_listen_start(wpa_s, timeout * 1000); if (res == 0 && timeout * 1000 > wpa_s->max_remain_on_chan) { wpa_s->p2p_long_listen = timeout * 1000;