[PATCH] P2P: fix after scan inconsistency
Johannes Berg
johannes
Thu Nov 25 11:43:24 PST 2010
From: Johannes Berg <johannes.berg at intel.com>
When a scan times out, the P2P state machine will
only do p2p_run_after_scan(), and not advance the
search. This is inconsistent, so move advancing
search into p2p_run_after_scan() and remove its
return value since it is no longer needed.
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
src/p2p/p2p.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
--- hostap.orig/src/p2p/p2p.c 2010-11-25 20:39:13.000000000 +0100
+++ hostap/src/p2p/p2p.c 2010-11-25 20:39:46.000000000 +0100
@@ -686,7 +686,7 @@ static void p2p_find_timeout(void *eloop
}
-static int p2p_run_after_scan(struct p2p_data *p2p)
+static void p2p_run_after_scan(struct p2p_data *p2p)
{
struct p2p_device *dev;
enum p2p_after_scan op;
@@ -707,7 +707,7 @@ static int p2p_run_after_scan(struct p2p
p2p->after_scan_tx->wait_time);
os_free(p2p->after_scan_tx);
p2p->after_scan_tx = NULL;
- return 1;
+ return;
}
op = p2p->start_after_scan;
@@ -720,7 +720,7 @@ static int p2p_run_after_scan(struct p2p
"requested Listen state");
p2p_listen(p2p, p2p->pending_listen_sec * 1000 +
p2p->pending_listen_usec / 1000);
- return 1;
+ return;
case P2P_AFTER_SCAN_CONNECT:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Start previously "
"requested connect with " MACSTR,
@@ -732,10 +732,11 @@ static int p2p_run_after_scan(struct p2p
break;
}
p2p_connect_send(p2p, dev);
- return 1;
+ return;
}
- return 0;
+ if (p2p->state == P2P_SEARCH)
+ p2p_continue_find(p2p);
}
@@ -2095,10 +2096,7 @@ void p2p_scan_res_handled(struct p2p_dat
p2p->p2p_scan_running = 0;
eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
- if (p2p_run_after_scan(p2p))
- return;
- if (p2p->state == P2P_SEARCH)
- p2p_continue_find(p2p);
+ p2p_run_after_scan(p2p);
}
More information about the Hostap
mailing list