summaryrefslogtreecommitdiff
path: root/profiles/scanparam
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-09-08 14:54:43 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2016-09-08 14:54:43 +0300
commit6b546af4b54d6a48fa77bfafc5a67b53293238d9 (patch)
tree683c05a5d650da2d2f491d127659c668a69e0f87 /profiles/scanparam
parenta39422136a874f7af4280a8d34437c2e2c73fcb3 (diff)
downloadbluez-6b546af4b54d6a48fa77bfafc5a67b53293238d9.tar.gz
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.
Diffstat (limited to 'profiles/scanparam')
-rw-r--r--profiles/scanparam/scan.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index d3ca762df..d12e09e8d 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -201,7 +201,6 @@ static int scan_param_accept(struct btd_service *service)
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 @@ static int scan_param_accept(struct btd_service *service)
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;
}