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