fix(nimble): Fix incorrect event deinit in gatt caching discovery

This commit is contained in:
Rahul Tank
2025-03-12 18:11:05 +05:30
parent 4831c488a4
commit 149eec704a
+21 -6
View File
@@ -1451,6 +1451,9 @@ static void ble_gattc_cache_search_all_svcs_cb(struct ble_npl_event *ev)
if (conn == NULL) {
return;
}
ble_npl_event_deinit(&conn->disc_ev);
op = &conn->pending_op;
dcb = op->cb;
SLIST_FOREACH(svc, &conn->svcs, next) {
@@ -1461,7 +1464,6 @@ static void ble_gattc_cache_search_all_svcs_cb(struct ble_npl_event *ev)
status = BLE_HS_EDONE;
dcb(conn->conn_handle, ble_gattc_cache_error(status, 0), &svc->svc, op->cb_arg);
ble_npl_event_deinit(&conn->disc_ev);
return;
}
@@ -1526,6 +1528,9 @@ ble_gattc_cache_conn_search_svc_by_uuid_cb(struct ble_npl_event *ev)
if (conn == NULL) {
return;
}
ble_npl_event_deinit(&conn->disc_ev);
op = &conn->pending_op;
dcb = op->cb;
SLIST_FOREACH(svc, &conn->svcs, next) {
@@ -1535,7 +1540,7 @@ ble_gattc_cache_conn_search_svc_by_uuid_cb(struct ble_npl_event *ev)
}
status = BLE_HS_EDONE;
dcb(conn_handle, ble_gattc_cache_error(status, 0), &svc->svc, op->cb_arg);
ble_npl_event_deinit(&conn->disc_ev);
return;
}
@@ -1584,6 +1589,9 @@ ble_gattc_cache_conn_search_inc_svcs_cb(struct ble_npl_event *ev)
if (conn == NULL) {
return;
}
ble_npl_event_deinit(&conn->disc_ev);
op = &conn->pending_op;
dcb = op->cb;
SLIST_FOREACH(svc, &conn->svcs, next) {
@@ -1594,7 +1602,7 @@ ble_gattc_cache_conn_search_inc_svcs_cb(struct ble_npl_event *ev)
}
status = BLE_HS_EDONE;
dcb(conn->conn_handle, ble_gattc_cache_error(status, 0), &svc->svc, op->cb_arg);
ble_npl_event_deinit(&conn->disc_ev);
return;
}
int
@@ -1644,6 +1652,9 @@ ble_gattc_cache_conn_search_all_chrs_cb(struct ble_npl_event *ev)
if (conn == NULL) {
return;
}
ble_npl_event_deinit(&conn->disc_ev);
op = &conn->pending_op;
dcb = op->cb;
svc = ble_gattc_cache_conn_svc_find_range(conn, op->start_handle);
@@ -1654,7 +1665,6 @@ ble_gattc_cache_conn_search_all_chrs_cb(struct ble_npl_event *ev)
status = BLE_HS_EDONE;
dcb(conn_handle, ble_gattc_cache_error(status, 0), &chr->chr, op->cb_arg);
ble_npl_event_deinit(&conn->disc_ev);
return;
}
@@ -1705,6 +1715,9 @@ ble_gattc_cache_conn_search_chrs_by_uuid_cb(struct ble_npl_event *ev)
if (conn == NULL) {
return;
}
ble_npl_event_deinit(&conn->disc_ev);
op = &conn->pending_op;
dcb = op->cb;
svc = ble_gattc_cache_conn_svc_find_range(conn, op->start_handle);
@@ -1717,7 +1730,6 @@ ble_gattc_cache_conn_search_chrs_by_uuid_cb(struct ble_npl_event *ev)
status = BLE_HS_EDONE;
dcb(conn_handle, ble_gattc_cache_error(status, 0), &chr->chr, op->cb_arg);
ble_npl_event_deinit(&conn->disc_ev);
return;
}
@@ -1768,6 +1780,9 @@ ble_gattc_cache_conn_search_all_dscs_cb(struct ble_npl_event *ev)
if (conn == NULL) {
return;
}
ble_npl_event_deinit(&conn->disc_ev);
op = &conn->pending_op;
dcb = op->cb;
svc = ble_gattc_cache_conn_svc_find_range(conn, op->start_handle);
@@ -1777,7 +1792,7 @@ ble_gattc_cache_conn_search_all_dscs_cb(struct ble_npl_event *ev)
}
status = BLE_HS_EDONE;
dcb(conn_handle, ble_gattc_cache_error(status, 0), chr->chr.val_handle, &dsc->dsc, op->cb_arg);
ble_npl_event_deinit(&conn->disc_ev);
return;
}