diff options
author | Irfan Sheriff <isheriff@google.com> | 2012-08-09 15:40:48 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2013-11-24 20:46:39 (GMT) |
commit | 87e2de6f955b85d23a5f00b52280711ee4243bfb (patch) | |
tree | 2b3de31c16bcc0df1a09de31ee6ddff2097a24ab /src/p2p/p2p_sd.c | |
parent | acb97b360033dba1cb26b17aeb8d204fca254b05 (diff) | |
download | hostap-87e2de6f955b85d23a5f00b52280711ee4243bfb.zip hostap-87e2de6f955b85d23a5f00b52280711ee4243bfb.tar.gz hostap-87e2de6f955b85d23a5f00b52280711ee4243bfb.tar.bz2 |
Fix p2p service discoveryandroid-jb
- Fix listen timing to improve SD reliability
- Fix SD packet scheduling
Bug: 6629112
Change-Id: I01365279439116256372d019bdbfd4b2113bf2ce
Diffstat (limited to 'src/p2p/p2p_sd.c')
-rw-r--r-- | src/p2p/p2p_sd.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c index 0e0c7f1..8aeb3c9 100644 --- a/src/p2p/p2p_sd.c +++ b/src/p2p/p2p_sd.c @@ -819,6 +819,20 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, const struct wpabuf *tlvs) { struct p2p_sd_query *q; +#ifdef ANDROID_P2P + /* Currently, supplicant doesn't support more than one pending + * broadcast SD request. So reject if application is registering + * another one before cancelling the existing one. + */ + for (q = p2p->sd_queries; q; q = q->next) { + if ((q->for_all_peers == 1) && !dst) { + wpa_printf(MSG_ERROR, "P2P: Already one pending " + "Broadcast request. Please cancel the " + "current one before adding a new one"); + return NULL; + } + } +#endif /* ANDROID_P2P */ q = os_zalloc(sizeof(*q)); if (q == NULL) @@ -837,7 +851,7 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst, q->next = p2p->sd_queries; p2p->sd_queries = q; - p2p_dbg(p2p, "Added SD Query %p", q); + p2p_dbg(p2p, "Added SD Query %p for_all_peers %d", q, q->for_all_peers); if (dst == NULL) { struct p2p_device *dev; @@ -871,7 +885,24 @@ void p2p_sd_service_update(struct p2p_data *p2p) int p2p_sd_cancel_request(struct p2p_data *p2p, void *req) { if (p2p_unlink_sd_query(p2p, req)) { +#ifdef ANDROID_P2P + struct p2p_device *dev; + struct p2p_sd_query *q = req; +#endif /* ANDROID_P2P */ p2p_dbg(p2p, "Cancel pending SD query %p", req); +#ifdef ANDROID_P2P + /* If the request is a bcast query, then clear the + * P2P_DEV_SD_INFO flag so that when new sd query is + * registered,* we will send the SD request frames to peer + * devices. + */ + if (q->for_all_peers) { + p2p->sd_dev_list = NULL; + dl_list_for_each(dev, &p2p->devices, + struct p2p_device, list) + dev->flags &= ~P2P_DEV_SD_INFO; + } +#endif /* ANDROID_P2P */ p2p_free_sd_query(req); return 0; } |