GATT: Remove unhandled request info 52/238652/1
authorinjun.yang <injun.yang@samsung.com>
Tue, 14 Jul 2020 12:08:51 +0000 (21:08 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 16 Jul 2020 05:13:03 +0000 (14:13 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] Server app send response, but it is handled as invalid request info
[Cause & Measure] request info is not removed on previous link. Remove request info.
[Checking Method] n/a

[Team] Convergence BT
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: Id6cc4293f6ab9a89948ecda35ed481793a9f7d5a
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
bt-service/services/gatt/bt-service-gatt.c

index 6e8fb60..f0a55bd 100644 (file)
@@ -431,6 +431,30 @@ static struct gatt_server_req_info *__bt_gatt_server_find_request_info(int reque
        return NULL;
 }
 
+static void __bt_gatt_server_release_request_info(const char *address)
+{
+       GSList *l;
+       struct gatt_server_req_info *req_info = NULL;
+
+       for (l = gatt_server_requests; l != NULL; l = g_slist_next(l)) {
+               req_info = l->data;
+               if (req_info == NULL)
+                       continue;
+
+               if (g_strcmp0(req_info->addr, address) == 0) {
+                       g_free(req_info->addr);
+                       break;
+               }
+       }
+
+       if (req_info) {
+               BT_DBG("Remove unhandled req_info %s", address);
+               gatt_server_requests = g_slist_remove(gatt_server_requests, req_info);
+       }
+
+       return;
+}
+
 void _bt_get_adv_handle_from_instance(int server_inst, int *adv_handle)
 {
        BT_DBG("+");
@@ -1614,8 +1638,12 @@ static void __bt_handle_gatt_server_disconnection_state(event_gatts_conn_t *even
                                address, BT_ADDRESS_STRING_SIZE);
        }
 
+       /* Remove previous invalid request info */
+       __bt_gatt_server_release_request_info(address);
+
        BT_INFO("Local GATT Server DisConnected: Remote Client addr[%s] Server Instance [%d] Connection ID [%d]",
                        address + 12, event->server_inst, event->conn_id);
+
        /* Remove Connection info */
        client_info = _bt_find_remote_gatt_client_info(address);
        if (client_info) {