3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 22:19:23 +01:00

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.
This commit is contained in:
Tim Kourt 2019-02-26 15:28:58 -08:00 committed by Denis Kenzior
parent 8fc7c0e5c4
commit 8e44760c34

View File

@ -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; sc->state = sr->passive ? SCAN_STATE_PASSIVE : SCAN_STATE_ACTIVE;
l_debug("%s scan triggered for ifindex: %u", l_debug("%s scan triggered for ifindex: %u",
sr->passive ? "Passive" : "Active", sc->ifindex); sr->passive ? "Passive" : "Active", sc->ifindex);
sc->triggered = true; sc->triggered = true;
l_genl_msg_unref(l_queue_pop_head(sr->cmds));
if (sr->trigger) { if (sr->trigger) {
sr->trigger(0, sr->userdata); 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, static int scan_request_send_next(struct scan_context *sc,
struct scan_request *sr) 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) if (!cmd)
return -ENOMSG; return -ENOMSG;
@ -457,7 +459,6 @@ static int scan_request_send_next(struct scan_context *sc,
return 0; return 0;
} }
l_genl_msg_unref(cmd);
return -EIO; return -EIO;
} }