[PATCH BlueZ 4/4] share/gatt-client: Don't remove active services

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Only remove services that have not been fetched completed as
unsuccessful discovery may be the result of an aborted connection the
attributes that have been fetched previously are likely to be valid.
---
 src/shared/gatt-client.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index e21aca1f0..5ba8e83ba 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -407,11 +407,17 @@ static void discovery_op_complete(struct discovery_op *op, bool success,
 	gatt_db_unregister(op->client->db, op->db_id);
 	op->db_id = 0;
 
-	/* Remove services pending */
+	/* Remove staled services */
 	for (svc = queue_get_entries(op->pending_svcs); svc; svc = svc->next) {
 		struct gatt_db_attribute *attr = svc->data;
 		uint16_t start, end;
 
+		/* Don't remove services that already been marked as active
+		 * previously.
+		 */
+		if (gatt_db_service_get_active(attr))
+			continue;
+
 		gatt_db_attribute_get_service_data(attr, &start, &end,
 							NULL, NULL);
 
-- 
2.25.3




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux