Skip to contentSkip to conversation

advertising: reply in RegisterAdvertisement on success

PATCH New Rafał Miłecki 1 participant 1 message Aug 6, 2019 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 advertising: reply in RegisterAdvertisement on success

From: Rafał Miłecki <[email protected]>

RegisterAdvertisement method handler sends a reply message on all kind of errors. It makes waiting for a reply and checking it very useful on the caller side. There are errors like InvalidArguments, AlreadyExists, etc. defined.

A missing reply on RegisterAdvertisement success was causing dbus_pending_call_block() to block caller and was resulting in the org.freedesktop.DBus.Error.NoReply after a timeout.

---
Hi,

I'm writing my first BlueZ app using C language and I run into this timeout + org.freedesktop.DBus.Error.NoReply problem. I found this fix and tested it successfully.

I can see that many methods handler do the same, e.g.:
UnregisterAdvertisement, RegisterProfile and UnregisterApplication.

Let me know if you see any problem with this patch/fix.

---
 src/advertising.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/advertising.c +1 -1
index 3ed13766c..43591ae42 100644
@@ -1190,7 +1190,7 @@ static DBusMessage *register_advertisement(DBusConnection *conn,
 
 	queue_push_tail(manager->clients, client);
 
-	return NULL;
+	return dbus_message_new_method_return(msg);
 }
 
 static DBusMessage *unregister_advertisement(DBusConnection *conn,
Signature · 1 line
2.21.0