From ccad05a95cbac982442d56570fe96b77e6802f5a Mon Sep 17 00:00:00 2001 From: Krishna Vamsi Date: Thu, 28 May 2015 19:47:41 +0530 Subject: [PATCH] P2P: Restart group formation timer upon receiving new Inv Req A new Invitation Request might be received on a just started persistent group if the previous Invitation Response sent isn't received at the peer (GO of the persistent group). When the peer sends an Invitation Request again, treat it as start of group formation and restart the group formation timer at this point of time. Signed-off-by: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 23ab10d59..e7a4db3a6 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -5488,6 +5488,23 @@ int wpas_p2p_group_add_persistent(struct wpa_supplicant *wpa_s, go == (ssid->mode == WPAS_MODE_P2P_GO)) { wpa_printf(MSG_DEBUG, "P2P: Requested persistent group is " "already running"); + if (go == 0 && + eloop_cancel_timeout(wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL)) { + /* + * This can happen if Invitation Response frame was lost + * and the peer (GO of a persistent group) tries to + * invite us again. Reschedule the timeout to avoid + * terminating the wait for the connection too early + * since we now know that the peer is still trying to + * invite us instead of having already started the GO. + */ + wpa_printf(MSG_DEBUG, + "P2P: Reschedule group formation timeout since peer is still trying to invite us"); + eloop_register_timeout(P2P_MAX_INITIAL_CONN_WAIT, 0, + wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL); + } return 0; }