aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2013-09-05 22:11:21 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2013-09-05 22:11:21 -0700
commit58c9d4849aca07bf41502d688c6611fd48d008f8 (patch)
treee258787be9867d388db95dff8228f9880dd71402
parentc5a2569b4c7fa7c04e38717d74ca23809b075f8f (diff)
parenteb07357439d605caf8d872eb2f4690856faa7ce7 (diff)
downloadandroid_external_wpa_supplicant_8-58c9d4849aca07bf41502d688c6611fd48d008f8.tar.gz
android_external_wpa_supplicant_8-58c9d4849aca07bf41502d688c6611fd48d008f8.tar.bz2
android_external_wpa_supplicant_8-58c9d4849aca07bf41502d688c6611fd48d008f8.zip
Merge "P2P: Postpone concurrent scans when waiting for first client as GO"
-rw-r--r--wpa_supplicant/p2p_supplicant.c28
-rw-r--r--wpa_supplicant/wpa_supplicant_i.h1
2 files changed, 28 insertions, 1 deletions
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index b8e078d0..efcee18b 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -61,6 +61,16 @@
#define P2P_MAX_INITIAL_CONN_WAIT 10
#endif /* P2P_MAX_INITIAL_CONN_WAIT */
+#ifndef P2P_MAX_INITIAL_CONN_WAIT_GO
+/*
+ * How many seconds to wait for initial 4-way handshake to get completed after
+ * WPS provisioning step on the GO. This controls the extra time the P2P
+ * operation is considered to be in progress (e.g., to delay other scans) after
+ * WPS provisioning has been completed on the GO during group formation.
+ */
+#define P2P_MAX_INITIAL_CONN_WAIT_GO 10
+#endif /* P2P_MAX_INITIAL_CONN_WAIT_GO */
+
#ifndef P2P_CONCURRENT_SEARCH_DELAY
#define P2P_CONCURRENT_SEARCH_DELAY 500
#endif /* P2P_CONCURRENT_SEARCH_DELAY */
@@ -736,8 +746,10 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
ssid, go_dev_addr);
if (network_id < 0 && ssid)
network_id = ssid->id;
- if (!client)
+ if (!client) {
wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 0);
+ os_get_time(&wpa_s->global->p2p_go_wait_client);
+ }
}
@@ -5742,6 +5754,19 @@ int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s)
}
}
+ if (!ret && wpa_s->global->p2p_go_wait_client.sec) {
+ struct os_time now;
+ os_get_time(&now);
+ if (now.sec > wpa_s->global->p2p_go_wait_client.sec +
+ P2P_MAX_INITIAL_CONN_WAIT_GO) {
+ /* Wait for the first client has expired */
+ wpa_s->global->p2p_go_wait_client.sec = 0;
+ } else {
+ wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Waiting for initial client connection during group formation");
+ ret = 1;
+ }
+ }
+
return ret;
}
@@ -5801,6 +5826,7 @@ struct wpa_ssid * wpas_p2p_get_persistent(struct wpa_supplicant *wpa_s,
void wpas_p2p_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *addr)
{
+ wpa_s->global->p2p_go_wait_client.sec = 0;
if (addr == NULL)
return;
wpas_p2p_add_persistent_group_client(wpa_s, addr);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 748fcf7f..f583626d 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -238,6 +238,7 @@ struct wpa_global {
struct wpa_supplicant *p2p_group_formation;
struct wpa_supplicant *p2p_invite_group;
u8 p2p_dev_addr[ETH_ALEN];
+ struct os_time p2p_go_wait_client;
struct dl_list p2p_srv_bonjour; /* struct p2p_srv_bonjour */
struct dl_list p2p_srv_upnp; /* struct p2p_srv_upnp */
int p2p_disabled;