summaryrefslogtreecommitdiffstats
path: root/hcid/agent.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-06-06 08:48:50 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-06-06 08:48:50 +0000
commitda2de444d0c8c3948994817bcbd2f27e1a92203d (patch)
tree9f3b704e7fb6dd09944c936e20b0187bc1f2705c /hcid/agent.c
parent081beca5ac609c6a90feef695c2df6a8f9144683 (diff)
More agent fixes
Diffstat (limited to 'hcid/agent.c')
-rw-r--r--hcid/agent.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/hcid/agent.c b/hcid/agent.c
index ed9976fe..802323a9 100644
--- a/hcid/agent.c
+++ b/hcid/agent.c
@@ -154,8 +154,7 @@ static void agent_free(struct agent *agent)
agent_pincode_cb pincode_cb;
agent_cb cb;
- if (agent->request->call)
- dbus_pending_call_cancel(agent->request->call);
+ agent_cancel(agent);
dbus_error_init(&err);
dbus_set_error_const(&err, "org.bluez.Error.Failed", "Canceled");
@@ -171,11 +170,6 @@ static void agent_free(struct agent *agent)
}
dbus_error_free(&err);
-
- if (!agent->exited)
- send_cancel_request(agent->request);
-
- agent_request_free(agent->request);
}
if (!agent->exited) {
@@ -240,14 +234,14 @@ static struct agent_request *agent_request_new(struct agent *agent,
int agent_cancel(struct agent *agent)
{
- int ret;
-
if (!agent->request)
return -EINVAL;
- ret = send_cancel_request(agent->request);
- if (ret < 0)
- return ret;
+ if (agent->request->call)
+ dbus_pending_call_cancel(agent->request->call);
+
+ if (!agent->exited)
+ send_cancel_request(agent->request);
agent_request_free(agent->request);
agent->request = NULL;