P2P: Handle p2p_scan tracking in SEARCH state

Previously, only the initial p2p_scan was used to delay starting new
P2P operations. However, this should have applied to the SEARCH state
scans, too.
This commit is contained in:
Jouni Malinen 2010-06-23 22:37:27 -07:00 committed by Jouni Malinen
parent 07a30a66c3
commit 40c03fd40b

View file

@ -32,8 +32,17 @@ static void p2p_process_presence_resp(struct p2p_data *p2p, const u8 *da,
const u8 *sa, const u8 *data, const u8 *sa, const u8 *data,
size_t len); size_t len);
static void p2p_ext_listen_timeout(void *eloop_ctx, void *timeout_ctx); static void p2p_ext_listen_timeout(void *eloop_ctx, void *timeout_ctx);
static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx);
/*
* p2p_scan recovery timeout
*
* Many drivers are using 30 second timeout on scan results. Allow a bit larger
* timeout for this to avoid hitting P2P timeout unnecessarily.
*/
#define P2P_SCAN_TIMEOUT 35
/** /**
* P2P_PEER_EXPIRATION_AGE - Number of seconds after which inactive peer * P2P_PEER_EXPIRATION_AGE - Number of seconds after which inactive peer
* entries will be removed * entries will be removed
@ -647,6 +656,12 @@ static void p2p_search(struct p2p_data *p2p)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Scan request failed"); "P2P: Scan request failed");
p2p_continue_find(p2p); p2p_continue_find(p2p);
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Running p2p_scan");
p2p->p2p_scan_running = 1;
eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
eloop_register_timeout(P2P_SCAN_TIMEOUT, 0, p2p_scan_timeout,
p2p, NULL);
} }
} }
@ -693,14 +708,6 @@ static int p2p_run_after_scan(struct p2p_data *p2p)
} }
/*
* p2p_scan recovery timeout
*
* Many drivers are using 30 second timeout on scan results. Allow a bit larger
* timeout for this to avoid hitting P2P timeout unnecessarily.
*/
#define P2P_SCAN_TIMEOUT 35
static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx) static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx)
{ {
struct p2p_data *p2p = eloop_ctx; struct p2p_data *p2p = eloop_ctx;