From: Jouni Malinen Date: Fri, 1 Nov 2013 10:21:43 +0000 (+0200) Subject: AOSP: Some P2P connection-in-progress changes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a3248898a1232d9394b040d381a3883156221d2;p=thirdparty%2Fhostap.git AOSP: Some P2P connection-in-progress changes The p2p_search_pending() function is not used anywhere. That part should be reverted. These came in as part of this AOSP commit: commit 2fb777c379ad560c309c54b96c2c13291da23f54 Author: Dmitry Shmidt Date: Wed May 2 12:29:53 2012 -0700 wpa_supplicant: Update to Version 0.8.26 from BRCM - Add interface command - Improve scan handling during P2P BUG: b/6324527, b/6427094 Change-Id: I4425f44d2a15de0725ba4a1b42cc56e10954b314 Signed-off-by: Dmitry Shmidt --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 6b41a097d..3d08d060d 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -41,10 +41,40 @@ static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx); * P2P_PEER_EXPIRATION_AGE - Number of seconds after which inactive peer * entries will be removed */ +#ifdef ANDROID_P2P +#define P2P_PEER_EXPIRATION_AGE 30 +#else #define P2P_PEER_EXPIRATION_AGE 300 +#endif #define P2P_PEER_EXPIRATION_INTERVAL (P2P_PEER_EXPIRATION_AGE / 2) +#ifdef ANDROID_P2P +int p2p_connection_in_progress(struct p2p_data *p2p) +{ + int ret = 0; + + switch (p2p->state) { + case P2P_CONNECT: + case P2P_CONNECT_LISTEN: + case P2P_GO_NEG: + case P2P_WAIT_PEER_CONNECT: + case P2P_WAIT_PEER_IDLE: + case P2P_PROVISIONING: + case P2P_INVITE: + case P2P_INVITE_LISTEN: + ret = 1; + break; + + default: + wpa_printf(MSG_DEBUG, "p2p_connection_in_progress state %d", p2p->state); + ret = 0; + } + + return ret; +} +#endif + static void p2p_expire_peers(struct p2p_data *p2p) { struct p2p_device *dev, *n; @@ -81,6 +111,13 @@ static void p2p_expire_peers(struct p2p_data *p2p) continue; } +#ifdef ANDROID_P2P + /* If Connection is in progress, don't expire the peer + */ + if (p2p_connection_in_progress(p2p)) + continue; +#endif + p2p_dbg(p2p, "Expiring old peer entry " MACSTR, MAC2STR(dev->info.p2p_device_addr)); @@ -1074,6 +1111,18 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout, return res; } +#ifdef ANDROID_P2P +int p2p_search_pending(struct p2p_data *p2p) +{ + if(p2p == NULL) + return 0; + + if(p2p->state == P2P_SEARCH_WHEN_READY) + return 1; + + return 0; +} +#endif int p2p_other_scan_completed(struct p2p_data *p2p) { diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 93429337f..7f845b23a 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1779,6 +1779,14 @@ int p2p_in_progress(struct p2p_data *p2p); */ int p2p_search_in_progress(struct p2p_data *p2p); +/** + * p2p_search_pending - Check whether there is a deferred P2P SEARCH + * @p2p: P2P module context from p2p_init() + * Returns: 0 if there is no deferred P2P search or 1 if there is one + */ +int p2p_search_pending(struct p2p_data *p2p); +#endif + /** * p2p_other_scan_completed - Notify completion of non-P2P scan * @p2p: P2P module context from p2p_init()