Fix list_gatt_info cleanup issue 82/228082/1
authorWootak Jung <wootak.jung@samsung.com>
Thu, 19 Mar 2020 03:08:28 +0000 (12:08 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 19 Mar 2020 03:08:28 +0000 (12:08 +0900)
list_gatt_info should be removed in case of GATT SERVER DISCONNECTED
as well as GATT CLIENT DISCONNECTED

Change-Id: Ib8f7673716d26ac2733d54ebd24ffaca5438a92b

bt-service-adaptation/services/gatt/bt-service-gatt.c

index 5a9dc01..ca85a17 100644 (file)
@@ -287,9 +287,10 @@ static void __bt_handle_client_notification_registered(event_gattc_regdereg_noti
 static void __bt_handle_client_notification_data(event_gattc_notify_data *event_data);
 static void __bt_handle_client_service_changed_ind(event_gattc_service_changed_data *event_data);
 static void __bt_handle_client_mtu_exchange_completed(event_gattc_mtu_configured_t *event_data);
-
 #endif
+
 static int __bt_unregister_gatt_server_instance(int server_instance);
+static void __bt_cleanup_remote_services(struct gatt_server_info_t *conn_info);
 
 /*mtu device list*/
 struct gatt_mtu_info_t {
@@ -1627,6 +1628,12 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
                        gatt_server_info_list = g_slist_remove(gatt_server_info_list, server_info);
                else
                        BT_INFO("Can not find conn info, already removed!");
+
+               /* Remove all services from info list_gatt_info */
+               __bt_cleanup_remote_services(server_info);
+#else
+               /* Remove all services from info list_gatt_info */
+               __bt_cleanup_remote_services(client_info);
 #endif
 
                /* Remove client info from List */