3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 13:59:24 +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:
Jukka Rissanen 2015-03-02 16:19:06 +02:00 committed by Denis Kenzior
parent c275fca1e3
commit 405b724266
2 changed files with 26 additions and 0 deletions

View File

@ -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;

View File

@ -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);