2020-09-17 07:09:31

by Miao-chen Chou

[permalink] [raw]
Subject: [BlueZ PATCH v3 7/8] adv_monitor: Fix return type of RegisterMonitor() method

This modifies the D-Bus call return type to be asynchronous for
RegisterMonitor() method call.

The following test was performed:
- Enter bluetoothctl, exit the console and re-enter the console without
AlreadyExist error for RegisterMonitor() upon bring-up of the console.

Reviewed-by: Howard Chung <[email protected]>
Reviewed-by: Manish Mandlik <[email protected]>
---

(no changes since v1)

src/adv_monitor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/adv_monitor.c b/src/adv_monitor.c
index deaa1894a..b4fe39eff 100644
--- a/src/adv_monitor.c
+++ b/src/adv_monitor.c
@@ -758,6 +758,8 @@ static struct adv_monitor_app *app_create(DBusConnection *conn,

app->monitors = queue_new();

+ app->reg = dbus_message_ref(msg);
+
g_dbus_client_set_disconnect_watch(app->client, app_disconnect_cb, app);

/* Note that any property changes on a monitor object would not affect
@@ -769,8 +771,6 @@ static struct adv_monitor_app *app_create(DBusConnection *conn,

g_dbus_client_set_ready_watch(app->client, app_ready_cb, app);

- app->reg = dbus_message_ref(msg);
-
return app;
}

@@ -864,7 +864,7 @@ static DBusMessage *unregister_monitor(DBusConnection *conn,
}

static const GDBusMethodTable adv_monitor_methods[] = {
- { GDBUS_EXPERIMENTAL_METHOD("RegisterMonitor",
+ { GDBUS_EXPERIMENTAL_ASYNC_METHOD("RegisterMonitor",
GDBUS_ARGS({ "application", "o" }),
NULL, register_monitor) },
{ GDBUS_EXPERIMENTAL_ASYNC_METHOD("UnregisterMonitor",
--
2.26.2