scanparam: Fix not handling accept properly
On accept the profile shall check about existing attribute, etc and once
done call btd_service_connecting_complete updating the service state
properly.
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index d3ca762..d12e09e 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -201,7 +201,6 @@
gatt_db_unref(scan->db);
bt_gatt_client_unref(scan->client);
-
scan->db = gatt_db_ref(db);
scan->client = bt_gatt_client_ref(client);
@@ -209,6 +208,17 @@
gatt_db_foreach_service(db, &scan_parameters_uuid,
foreach_scan_param_service, scan);
+ if (!scan->attr) {
+ error("Scan Parameters attribute not found");
+ gatt_db_unref(scan->db);
+ scan->db = NULL;
+ bt_gatt_client_unref(scan->client);
+ scan->client = NULL;
+ return -1;
+ }
+
+ btd_service_connecting_complete(service, 0);
+
return 0;
}