mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 02:19:26 +01:00
agent: Cancel pending agent request
Allow user to cancel a pending user agent request. This typically happens when user decides to disconnect a pending connection request.
This commit is contained in:
parent
c275fca1e3
commit
405b724266
25
src/agent.c
25
src/agent.c
@ -273,6 +273,31 @@ unsigned int agent_request_passphrase(const char *path,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static bool find_request(const void *a, const void *b)
|
||||
{
|
||||
const struct agent_request *request = a;
|
||||
unsigned int id = L_PTR_TO_UINT(b);
|
||||
|
||||
return request->id == id;
|
||||
}
|
||||
|
||||
bool agent_request_cancel(unsigned int req_id)
|
||||
{
|
||||
struct agent_request *request;
|
||||
|
||||
request = l_queue_remove_if(default_agent->requests, find_request,
|
||||
L_UINT_TO_PTR(req_id));
|
||||
if (!request)
|
||||
return false;
|
||||
|
||||
if (!request->message)
|
||||
send_cancel_request(default_agent);
|
||||
|
||||
agent_request_free(request);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void agent_disconnect(struct l_dbus *dbus, void *user_data)
|
||||
{
|
||||
struct agent *agent = user_data;
|
||||
|
@ -38,3 +38,4 @@ bool agent_setup(struct l_dbus_interface *interface);
|
||||
unsigned int agent_request_passphrase(const char *path,
|
||||
agent_request_passphrase_func_t callback,
|
||||
void *user_data);
|
||||
bool agent_request_cancel(unsigned int req_id);
|
||||
|
Loading…
Reference in New Issue
Block a user