diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/p2p/p2p.c | 13 | ||||
-rw-r--r-- | src/p2p/p2p.h | 9 | ||||
-rw-r--r-- | src/p2p/p2p_go_neg.c | 4 | ||||
-rw-r--r-- | src/p2p/p2p_i.h | 3 | ||||
-rw-r--r-- | src/p2p/p2p_invitation.c | 3 |
5 files changed, 29 insertions, 3 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 30042b0..e905e77 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -2382,6 +2382,9 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg) eloop_register_timeout(P2P_PEER_EXPIRATION_INTERVAL, 0, p2p_expiration_timeout, p2p, NULL); + p2p->go_timeout = 100; + p2p->client_timeout = 20; + return p2p; } @@ -4105,3 +4108,13 @@ int p2p_non_idle(struct p2p_data *p2p) return 0; return p2p->state != P2P_IDLE; } + + +void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout, + u8 client_timeout) +{ + if (p2p) { + p2p->go_timeout = go_timeout; + p2p->client_timeout = client_timeout; + } +} diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 6c4b666..3f796d0 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1727,4 +1727,13 @@ const char * p2p_wps_method_text(enum p2p_wps_method method); int p2p_prepare_channel(struct p2p_data *p2p, unsigned int force_freq); +/** + * p2p_set_config_timeout - Set local config timeouts + * @p2p: P2P module context from p2p_init() + * @go_timeout: Time in 10 ms units it takes to start the GO mode + * @client_timeout: Time in 10 ms units it takes to start the client mode + */ +void p2p_set_config_timeout(struct p2p_data *p2p, u8 go_timeout, + u8 client_timeout); + #endif /* P2P_H */ diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 68bc1b2..db12e9d 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -161,7 +161,7 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p, p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | p2p->next_tie_breaker); p2p->next_tie_breaker = !p2p->next_tie_breaker; - p2p_buf_add_config_timeout(buf, 100, 20); + p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout); p2p_buf_add_listen_channel(buf, p2p->cfg->country, p2p->cfg->reg_class, p2p->cfg->channel); if (p2p->ext_listen_interval) @@ -274,7 +274,7 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p, ~P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY, group_capab); p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker); - p2p_buf_add_config_timeout(buf, 100, 20); + p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout); if (peer && peer->go_state == REMOTE_GO) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating " "Channel attribute"); diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index ca5fc3a..d254818 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -432,6 +432,9 @@ struct p2p_data { * in IDLE state. */ int pd_retries; + + u8 go_timeout; + u8 client_timeout; }; /** diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c index 65c5477..c70fc7a 100644 --- a/src/p2p/p2p_invitation.c +++ b/src/p2p/p2p_invitation.c @@ -36,7 +36,8 @@ static struct wpabuf * p2p_build_invitation_req(struct p2p_data *p2p, if (p2p->inv_role == P2P_INVITE_ROLE_ACTIVE_GO || !p2p->inv_persistent) p2p_buf_add_config_timeout(buf, 0, 0); else - p2p_buf_add_config_timeout(buf, 100, 20); + p2p_buf_add_config_timeout(buf, p2p->go_timeout, + p2p->client_timeout); p2p_buf_add_invitation_flags(buf, p2p->inv_persistent ? P2P_INVITATION_FLAGS_TYPE : 0); p2p_buf_add_operating_channel(buf, p2p->cfg->country, |