P2P: Restart group formation timer upon receiving new Inv Req
authorKrishna Vamsi <vamsin@qti.qualcomm.com>
Thu, 28 May 2015 14:17:41 +0000 (19:47 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 29 May 2015 10:30:26 +0000 (13:30 +0300)
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 <jouni@qca.qualcomm.com>
wpa_supplicant/p2p_supplicant.c

index 23ab10d..e7a4db3 100644 (file)
@@ -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;
        }