summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-03-14 21:38:18 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-03-14 21:38:18 +0000
commitab183f415cfc7064c5e74a1a7bcfa0aba3ca846c (patch)
tree4456b90e01686266f61d4ae248eb3b927fb56195
parent0dee137d5600d77852c2f67c36831a2d4c00d920 (diff)
Make sure the request type is set so agent_free does the right thing in all scenarios
-rw-r--r--hcid/agent.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/hcid/agent.c b/hcid/agent.c
index b31bad03..2725b8c9 100644
--- a/hcid/agent.c
+++ b/hcid/agent.c
@@ -77,7 +77,6 @@ struct agent {
struct agent_request {
agent_request_type_t type;
struct agent *agent;
- char remote_address[18];
DBusPendingCall *call;
void *cb;
void *user_data;
@@ -181,6 +180,7 @@ int agent_destroy(struct agent *agent, gboolean exited)
}
static struct agent_request *agent_request_new(struct agent *agent,
+ agent_request_type_t type,
void *cb,
void *user_data)
{
@@ -189,6 +189,7 @@ static struct agent_request *agent_request_new(struct agent *agent,
req = g_new0(struct agent_request, 1);
req->agent = agent;
+ req->type = type;
req->cb = cb;
req->user_data = user_data;
@@ -306,7 +307,7 @@ int agent_authorize(struct agent *agent,
if (agent->request)
return -EBUSY;
- req = agent_request_new(agent, cb, user_data);
+ req = agent_request_new(agent, AGENT_REQUEST_AUTHORIZE, cb, user_data);
req->call = agent_call_authorize(agent, device->path, uuid);
if (!req->call) {
@@ -426,7 +427,7 @@ int agent_request_passkey(struct agent *agent, struct device *device,
if (agent->request)
return -EBUSY;
- req = agent_request_new(agent, cb, user_data);
+ req = agent_request_new(agent, AGENT_REQUEST_PASSKEY, cb, user_data);
req->call = passkey_request_new(agent, device->path, FALSE);
if (!req->call)
@@ -483,7 +484,8 @@ int agent_confirm_mode_change(struct agent *agent, const char *new_mode,
debug("Calling Agent.ConfirmModeChange: name=%s, path=%s, mode=%s",
agent->name, agent->path, new_mode);
- req = agent_request_new(agent, cb, user_data);
+ req = agent_request_new(agent, AGENT_REQUEST_CONFIRM_MODE,
+ cb, user_data);
req->call = confirm_mode_change_request_new(agent, new_mode);
if (!req->call)