]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Decrement sd_pending_bcast_queries when sd returns success
authorConstantin Musca <constantin.musca@intel.com>
Mon, 22 Sep 2014 12:00:37 +0000 (15:00 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Sep 2014 08:03:48 +0000 (11:03 +0300)
The sd_pending_bcast_queries variable should be decremented only
in case of success. This way, the supplicant can retry if a service
discovery request fails.

Signed-off-by: Constantin Musca <constantin.musca@intel.com>
src/p2p/p2p.c
src/p2p/p2p_sd.c

index 55b0410a18849a651fd3d6eab394838ea5ca55bb..f0eba1a1bc94f47badb8f29a1837a425651a08c4 100644 (file)
@@ -2788,6 +2788,19 @@ static void p2p_sd_cb(struct p2p_data *p2p, int success)
                return;
        }
 
+       if (p2p->sd_query->for_all_peers) {
+               /* Update the pending broadcast SD query count for this device
+                */
+               p2p->sd_peer->sd_pending_bcast_queries--;
+
+               /*
+                * If there are no pending broadcast queries for this device,
+                * mark it as done (-1).
+                */
+               if (p2p->sd_peer->sd_pending_bcast_queries == 0)
+                       p2p->sd_peer->sd_pending_bcast_queries = -1;
+       }
+
        /* Wait for response from the peer */
        p2p_set_state(p2p, P2P_SD_DURING_FIND);
        p2p_set_timeout(p2p, 0, 200000);
index 6235b1de43658ea7f34d0fb6fe6309075bb88680..13119c2005ebcff2a3b7e098c6feb90c90628fbf 100644 (file)
@@ -301,16 +301,6 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
                ret = -1;
        }
 
-       /* Update the pending broadcast SD query count for this device */
-       dev->sd_pending_bcast_queries--;
-
-       /*
-        * If there are no pending broadcast queries for this device, mark it as
-        * done (-1).
-        */
-       if (dev->sd_pending_bcast_queries == 0)
-               dev->sd_pending_bcast_queries = -1;
-
        wpabuf_free(req);
 
        return ret;