summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-adapter.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-05 20:39:15 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-09-05 20:39:15 +0000
commitf1604b8852a3d166363d18e750281a427e2ff948 (patch)
tree9fa5244abd6cbf84b980d9f3ed8ec7b18aa08499 /hcid/dbus-adapter.c
parentadf984f0cb0829b4509fdbe8bb8e3ded9c7e496c (diff)
Reply for CancelDiscovery now sent before send DiscoveryCompleted
Diffstat (limited to 'hcid/dbus-adapter.c')
-rw-r--r--hcid/dbus-adapter.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index dab3255f..a7f1ee7c 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -2246,7 +2246,6 @@ static DBusHandlerResult handle_dev_discover_devices_req(DBusConnection *conn, D
static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, DBusMessage *msg, void *data)
{
- DBusMessage *reply = NULL;
const char *requestor_name;
struct hci_dbus_data *dbus_data = data;
int err;
@@ -2259,9 +2258,10 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D
requestor_name = dbus_message_get_sender(msg);
- /* is there discover pending? */
- if (dbus_data->discover_state != STATE_DISCOVER &&
- dbus_data->discover_state != STATE_RESOLVING_NAMES)
+ /* is there discover pending? or discovery cancel was requested previously */
+ if ((dbus_data->discover_state != STATE_DISCOVER &&
+ dbus_data->discover_state != STATE_RESOLVING_NAMES) ||
+ dbus_data->discovery_cancel)
return error_not_authorized(conn, msg); /* FIXME: find a better error name */
/* only the discover requestor can cancel the inquiry process */
@@ -2281,8 +2281,9 @@ static DBusHandlerResult handle_dev_cancel_discovery_req(DBusConnection *conn, D
}
- reply = dbus_message_new_method_return(msg);
- return send_reply_and_unref(conn, reply);
+ /* Reply before send DiscoveryCompleted */
+ dbus_data->discovery_cancel = dbus_message_ref(msg);
+ return DBUS_HANDLER_RESULT_HANDLED;
}
const char *major_class_str(uint32_t class)