From: injun.yang Date: Tue, 14 Jul 2020 12:08:51 +0000 (+0900) Subject: GATT: Remove unhandled request info X-Git-Tag: submit/tizen/20200724.011403~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6175b125e98cfdc6aa26f183e989353ae31f7b3c;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git GATT: Remove unhandled request info [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 --- diff --git a/bt-service/services/gatt/bt-service-gatt.c b/bt-service/services/gatt/bt-service-gatt.c index 6e8fb60..f0a55bd 100644 --- a/bt-service/services/gatt/bt-service-gatt.c +++ b/bt-service/services/gatt/bt-service-gatt.c @@ -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) {