diff options
author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-06-18 22:28:07 +0000 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-06-18 22:28:07 +0000 |
commit | 95e5960735be4066d43f77d91ebe78771cd76a43 (patch) | |
tree | 92ed938c3aeaed8de14cd713255c7ac511c35dd6 | |
parent | 72b1f5668dee842f457d57a8e33afe26900ae14d (diff) |
Make RemoveDevice to return when the device is busy discovering services.
-rw-r--r-- | hcid/adapter.c | 2 | ||||
-rw-r--r-- | hcid/device.c | 17 |
2 files changed, 10 insertions, 9 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index 281dd86c..43a3a8b4 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -4055,7 +4055,7 @@ static DBusMessage *remove_device(DBusConnection *conn, "Device does not exist"); device = l->data; - if (device->temporary) + if (device->temporary || device->discov_active) return g_dbus_create_error(msg, ERROR_INTERFACE ".DoesNotExist", "Device creation in progress"); diff --git a/hcid/device.c b/hcid/device.c index 6736bb54..c0e64564 100644 --- a/hcid/device.c +++ b/hcid/device.c @@ -1071,14 +1071,6 @@ static DBusMessage *discover_services(DBusConnection *conn, goto fail; } - device->discov_active = 1; - device->discov_requestor = g_strdup(dbus_message_get_sender(msg)); - /* track the request owner to cancel it automatically if the owner - * exits */ - device->discov_listener = g_dbus_add_disconnect_watch(conn, - dbus_message_get_sender(msg), - discover_services_req_exit, - device, NULL); return NULL; fail: @@ -1489,6 +1481,15 @@ int device_browse(struct device *device, DBusConnection *conn, req->browse = TRUE; } + device->discov_active = 1; + device->discov_requestor = g_strdup(dbus_message_get_sender(msg)); + /* track the request owner to cancel it automatically if the owner + * exits */ + device->discov_listener = g_dbus_add_disconnect_watch(conn, + dbus_message_get_sender(msg), + discover_services_req_exit, + device, NULL); + return bt_search_service(&src, &dst, &uuid, browse_cb, req, NULL); } |