From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> 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.26.2