linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: "Szymon Janc" <szymon.janc@codecoup.pl>,
	"Rafał Miłecki" <rafal@milecki.pl>
Subject: [PATCH] advertising: reply in RegisterAdvertisement on success
Date: Tue,  6 Aug 2019 15:47:06 +0200	[thread overview]
Message-ID: <20190806134706.21453-1-zajec5@gmail.com> (raw)

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


                 reply	other threads:[~2019-08-06 13:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190806134706.21453-1-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=szymon.janc@codecoup.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).