diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 7b17eb908..bb1938dc3 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -4658,15 +4658,6 @@ static void p2p_ext_listen_timeout(void *eloop_ctx, void *timeout_ctx) p2p_ext_listen_timeout, p2p, NULL); } - if ((p2p->cfg->is_p2p_in_progress && - p2p->cfg->is_p2p_in_progress(p2p->cfg->cb_ctx)) || - (p2p->pending_action_state == P2P_PENDING_PD && - p2p->pd_retries > 0)) { - p2p_dbg(p2p, "Operation in progress - skip Extended Listen timeout (%s)", - p2p_state_txt(p2p->state)); - return; - } - if (p2p->state == P2P_LISTEN_ONLY && p2p->ext_listen_only) { /* * This should not really happen, but it looks like the Listen @@ -4679,6 +4670,15 @@ static void p2p_ext_listen_timeout(void *eloop_ctx, void *timeout_ctx) p2p_set_state(p2p, P2P_IDLE); } + if ((p2p->cfg->is_p2p_in_progress && + p2p->cfg->is_p2p_in_progress(p2p->cfg->cb_ctx)) || + (p2p->pending_action_state == P2P_PENDING_PD && + p2p->pd_retries > 0)) { + p2p_dbg(p2p, "Operation in progress - skip Extended Listen timeout (%s)", + p2p_state_txt(p2p->state)); + return; + } + if (p2p->state != P2P_IDLE) { p2p_dbg(p2p, "Skip Extended Listen timeout in active state (%s)", p2p_state_txt(p2p->state)); return;