Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] advertising: reply in RegisterAdvertisement on success
@ 2019-08-06 13:47 Rafał Miłecki
  0 siblings, 0 replies; only message in thread
From: Rafał Miłecki @ 2019-08-06 13:47 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc, Rafał Miłecki

From: Rafał Miłecki <rafal@milecki.pl>

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.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
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(-)

diff --git a/src/advertising.c b/src/advertising.c
index 3ed13766c..43591ae42 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -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,
-- 
2.21.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06 13:47 [PATCH] advertising: reply in RegisterAdvertisement on success Rafał Miłecki

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org linux-bluetooth@archiver.kernel.org
	public-inbox-index linux-bluetooth


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/ public-inbox