diff mbox series

[BlueZ,v1] gas: Fix reading attributes on every connection

Message ID 20240618195914.2470373-1-luiz.dentz@gmail.com
State New
Headers show
Series [BlueZ,v1] gas: Fix reading attributes on every connection | expand

Commit Message

Luiz Augusto von Dentz June 18, 2024, 7:59 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Attributes only need to be read once after that they will be persisted
by the core so there is no need to keep reading them on every
reconnection.
---
 profiles/gap/gas.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/profiles/gap/gas.c b/profiles/gap/gas.c
index dbe5f003bfba..08aaf19cb332 100644
--- a/profiles/gap/gas.c
+++ b/profiles/gap/gas.c
@@ -342,6 +342,10 @@  static int gap_accept(struct btd_service *service)
 		goto _finish;
 	}
 
+	/* Check if attribute already has been discovered */
+	if (gas->attr)
+		goto _finish;
+
 	gas->db = gatt_db_ref(db);
 	gas->client = bt_gatt_client_clone(client);
 
@@ -364,10 +368,6 @@  _finish:
 
 static int gap_disconnect(struct btd_service *service)
 {
-	struct gas *gas = btd_service_get_user_data(service);
-
-	gas_reset(gas);
-
 	btd_service_disconnecting_complete(service, 0);
 
 	return 0;