GATT: Clear g_pending_write_list when GATT disconnection occurs 78/252678/2 accepted/tizen/unified/20210203.145608 submit/tizen/20210201.221911
authorAyush Garg <ayush.garg@samsung.com>
Mon, 1 Feb 2021 08:54:08 +0000 (14:24 +0530)
committerPyun DoHyun <dh79.pyun@samsung.com>
Mon, 1 Feb 2021 22:01:26 +0000 (22:01 +0000)
This change will clear all the pending prepare_write_request
for a specific connection id when abrupt disconnection occurs
during GATT long write operation.

Change-Id: I6576329cb9d560c37f3d2b89243fa1f957424918
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
bt-service/services/gatt/bt-service-gatt.c

index 5b834cb..a07b268 100644 (file)
@@ -277,6 +277,9 @@ static void __bt_handle_client_mtu_exchange_completed(event_gattc_mtu_configured
 
 static int __bt_unregister_gatt_server_instance(int server_instance);
 static void __bt_cleanup_remote_services(struct gatt_server_info_t *conn_info);
+#ifdef TIZEN_BLUEDROID_PORTING
+static void __bt_remove_all_prep_write_req(int conn_id);
+#endif
 
 /*mtu device list*/
 struct gatt_mtu_info_t {
@@ -1607,6 +1610,10 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
        BT_INFO("Local GATT Server DisConnected: Remote Client addr[%s] Server Instance [%d] Connection ID [%d]",
                        address + 12, event->server_inst, event->conn_id);
 
+#ifdef TIZEN_BLUEDROID_PORTING
+       __bt_remove_all_prep_write_req(event->conn_id);
+#endif
+
        /* Remove Connection info */
        client_info = _bt_find_remote_gatt_client_info(address);
        if (client_info) {
@@ -1923,6 +1930,7 @@ static bool __bt_handle_gatt_server_prepare_write_response(int *res,
        bt_gatt_prep_write_data_t *prep_data = NULL;
        bt_gatt_prep_write_data_t *exec_data = NULL;
        int conn_id = -1;
+       int ret = OAL_STATUS_SUCCESS;
 
        /* Search for matching Request in prepare write List */
        prep_data = __bt_find_prep_write_data_from_request_id(param->request_id);