linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 5/5] shared/gatt-client: Fix handling of service changed
Date: Fri, 17 Jul 2020 12:15:15 -0700	[thread overview]
Message-ID: <20200717191515.220621-5-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20200717191515.220621-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

When handling multiple service changed multiple discovery operations
would be performed but at the end of each one the hash would be read
which not only would create extra traffic but also prevents the code
to properly detection services disappering.
---
 src/shared/gatt-client.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 409a3ee57..f6cff5014 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1460,8 +1460,10 @@ static bool read_db_hash(struct discovery_op *op)
 	struct bt_gatt_client *client = op->client;
 	bt_uuid_t uuid;
 
-	/* Check if hash was already read */
-	if (op->hash)
+	/* Check if hash was already been read or there are more services to
+	 * process.
+	 */
+	if (op->hash || !queue_isempty(client->svc_chngd_queue))
 		return false;
 
 	bt_uuid16_create(&uuid, GATT_CHARAC_DB_HASH);
-- 
2.26.2


  parent reply	other threads:[~2020-07-17 19:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-17 19:15 [PATCH BlueZ 1/5] shared/att: Fix possible crash on disconnect Luiz Augusto von Dentz
2020-07-17 19:15 ` [PATCH BlueZ 2/5] shared/gatt-db: Add support for notifying attribute changes Luiz Augusto von Dentz
2020-07-17 19:15 ` [PATCH BlueZ 3/5] shared/gatt-client: Remove notification if its attribute is removed Luiz Augusto von Dentz
2020-07-17 19:15 ` [PATCH BlueZ 4/5] shared/gatt-client: Don't remove active services Luiz Augusto von Dentz
2020-07-17 19:15 ` Luiz Augusto von Dentz [this message]
2020-07-17 19:20 ` [BlueZ,1/5] shared/att: Fix possible crash on disconnect bluez.test.bot
2020-07-17 19:23 ` bluez.test.bot
2020-07-17 20:32   ` Tedd Ho-Jeong An
2020-07-17 20:45     ` Luiz Augusto von Dentz
2020-07-17 21:52       ` Luiz Augusto von Dentz

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=20200717191515.220621-5-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).