3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-03 19:02:34 +01:00

agent: Fix cancelling running request

If the request being cancelled by agent_request_cancel has already been
sent over dbus we need to reset pending_id, the timeout, call l_dbus_cancel
to avoid the agent_receive_reply callback (and crash) and perhaps start
the next request.  Alternatively we could only reset the callback and not
free the request, then wait until the agent method to return before starting
the next request.
This commit is contained in:
Andrew Zaborowski 2018-02-20 02:05:17 +01:00 committed by Denis Kenzior
parent 55e8d7fdcc
commit 7fd6803c7a

View File

@ -381,9 +381,21 @@ bool agent_request_cancel(unsigned int req_id, int reason)
if (!request)
return false;
if (!request->message)
if (!request->message) {
send_cancel_request(agent, reason);
l_dbus_cancel(dbus_get_bus(), agent->pending_id);
agent->pending_id = 0;
if (agent->timeout) {
l_timeout_remove(agent->timeout);
agent->timeout = NULL;
}
agent_send_next_request(agent);
}
agent_request_free(request);
return true;