summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/adapter.c2
-rw-r--r--hcid/device.c17
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);
}