P2P: Stop listen state when listen-only duration is over

Even after listen duration is over, P2P module remained in
P2P_LISTEN_ONLY state, which is blocking station mode scans. Fix this by
stopping P2P listen explicitly to update p2p_state to IDLE when listen
duration expires.

Signed-hostap: Syed Asifful Dayyan <syedd@broadcom.com>
This commit is contained in:
Syed Asifful Dayyan Rafiuddeen 2013-08-31 18:09:15 +03:00 committed by Jouni Malinen
parent dd850f4a11
commit 0b5fb86a24
3 changed files with 24 additions and 0 deletions

View file

@ -1120,6 +1120,18 @@ void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq)
}
void p2p_stop_listen(struct p2p_data *p2p)
{
if (p2p->state != P2P_LISTEN_ONLY) {
p2p_dbg(p2p, "Skip stop_listen since not in listen_only state.");
return;
}
p2p_stop_listen_for_freq(p2p, 0);
p2p_set_state(p2p, P2P_IDLE);
}
void p2p_stop_find(struct p2p_data *p2p)
{
p2p_stop_find_for_freq(p2p, 0);

View file

@ -903,6 +903,12 @@ void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq);
*/
int p2p_listen(struct p2p_data *p2p, unsigned int timeout);
/**
* p2p_stop_listen - Stop P2P Listen
* @p2p: P2P module context from p2p_init()
*/
void p2p_stop_listen(struct p2p_data *p2p);
/**
* p2p_connect - Start P2P group formation (GO negotiation)
* @p2p: P2P module context from p2p_init()

View file

@ -4130,6 +4130,12 @@ void wpas_p2p_cancel_remain_on_channel_cb(struct wpa_supplicant *wpa_s,
if (wpa_s->p2p_long_listen > 0) {
wpa_printf(MSG_DEBUG, "P2P: Continuing long Listen state");
wpas_p2p_listen_start(wpa_s, wpa_s->p2p_long_listen);
} else {
/*
* When listen duration is over, stop listen & update p2p_state
* to IDLE.
*/
p2p_stop_listen(wpa_s->global->p2p);
}
}