P2P: Decrement sd_pending_bcast_queries when sd returns success

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>
This commit is contained in:
Constantin Musca 2014-09-22 15:00:37 +03:00 committed by Jouni Malinen
parent dbdc9a1d48
commit 7139cf4a4f
2 changed files with 13 additions and 10 deletions

View 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);