commit 8e44760c34bd40305d2c07d719c45298e52e2bb7
parent 8fc7c0e5c43d5cf7ce4d52dc2853015c1eee2c4d
Author: Tim Kourt <tim.a.kourt@linux.intel.com>
Date: Tue, 26 Feb 2019 15:28:58 -0800
scan: Fix scan request retry logic
While triggering scan, we leave the scan command in the queue,
so it can be replayed in the case of a busy device.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/scan.c b/src/scan.c
@@ -262,7 +262,9 @@ static void scan_request_triggered(struct l_genl_msg *msg, void *userdata)
sc->state = sr->passive ? SCAN_STATE_PASSIVE : SCAN_STATE_ACTIVE;
l_debug("%s scan triggered for ifindex: %u",
sr->passive ? "Passive" : "Active", sc->ifindex);
+
sc->triggered = true;
+ l_genl_msg_unref(l_queue_pop_head(sr->cmds));
if (sr->trigger) {
sr->trigger(0, sr->userdata);
@@ -446,7 +448,7 @@ static void scan_cmds_add(struct l_queue *cmds, struct scan_context *sc,
static int scan_request_send_next(struct scan_context *sc,
struct scan_request *sr)
{
- struct l_genl_msg *cmd = l_queue_pop_head(sr->cmds);
+ struct l_genl_msg *cmd = l_queue_peek_head(sr->cmds);
if (!cmd)
return -ENOMSG;
@@ -457,7 +459,6 @@ static int scan_request_send_next(struct scan_context *sc,
return 0;
}
- l_genl_msg_unref(cmd);
return -EIO;
}