From 6ca0afc43637441afb3c1a672ff02a4e95c79cd9 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 17 Jul 2020 12:07:01 -0700 Subject: [PATCH] shared/gatt-client: Don't remove active services If discovery was aborted (i.e due to a disconnect) check if pending services were active so only staled services which were not completed fetched are removed. --- src/shared/gatt-client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index e21aca1f0..409a3ee57 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -412,6 +412,10 @@ static void discovery_op_complete(struct discovery_op *op, bool success, struct gatt_db_attribute *attr = svc->data; uint16_t start, end; + /* Leave active services if operation was aborted */ + if ((!success && err == 0) && gatt_db_service_get_active(attr)) + continue; + gatt_db_attribute_get_service_data(attr, &start, &end, NULL, NULL); -- 2.47.3