summaryrefslogtreecommitdiffstats
path: root/hcid/agent.c
diff options
context:
space:
mode:
authorCidorvan Leite <cidorvan.leite@openbossa.org>2008-04-10 22:36:58 +0000
committerCidorvan Leite <cidorvan.leite@openbossa.org>2008-04-10 22:36:58 +0000
commitfb27732e05fb7b69c3b784ed8a6aaed2d9d939ae (patch)
treef6d262f6a6bf0733c761399b8e15b7ed130ae0c9 /hcid/agent.c
parent61a6576b2b7badd8963219873b631e6a51df612c (diff)
Added local agent in CreatePairedDevice
Diffstat (limited to 'hcid/agent.c')
-rw-r--r--hcid/agent.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/hcid/agent.c b/hcid/agent.c
index 3b85ebd4..f560f8d8 100644
--- a/hcid/agent.c
+++ b/hcid/agent.c
@@ -129,12 +129,9 @@ static void agent_request_free(struct agent_request *req)
static void agent_exited(const char *name, struct agent *agent)
{
- struct adapter *adapter = agent->adapter;
-
debug("Agent %s exited without calling Unregister", name);
agent_destroy(agent, TRUE);
- adapter->agent = NULL;
}
static void agent_free(struct agent *agent)
@@ -142,6 +139,9 @@ static void agent_free(struct agent *agent)
if (!agent)
return;
+ if (agent->remove_cb)
+ agent->remove_cb(agent, agent->remove_cb_data);
+
if (agent->request) {
DBusError err;
@@ -189,9 +189,6 @@ static gboolean agent_timeout(struct agent *agent)
agent->timeout = 0;
- if (agent->remove_cb)
- agent->remove_cb(agent, agent->remove_cb_data);
-
agent_free(agent);
return FALSE;
@@ -331,11 +328,8 @@ done:
agent->request = NULL;
agent_request_free(req);
- if (agent->addr) {
- if (agent->remove_cb)
- agent->remove_cb(agent, agent->remove_cb_data);
+ if (agent->addr)
agent_free(agent);
- }
}
int agent_authorize(struct agent *agent,
@@ -454,11 +448,8 @@ done:
dbus_pending_call_cancel(req->call);
agent_request_free(req);
- if (agent->addr) {
- if (agent->remove_cb)
- agent->remove_cb(agent, agent->remove_cb_data);
+ if (agent->addr)
agent_free(agent);
- }
}
int agent_request_passkey(struct agent *agent, struct device *device,