mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-28 19:57:23 +00:00
nimble/gatt: Fix the issue of removing multiple procs having same opcode
If two or more requests with same opcode are sent (for e.g. Write and Enable/Disable notify), the requests go through and responses are received. Although, the responses for all the requests except for the first one are not sent above to the app (or upper layers) This is because, currently ble_gattc_extract_first_by_conn_op() extracts all the matching procs and then they are removed from the list. Ideally, it should extract the first matching proc (as its name suggests). This patch modifies ble_gattc_extract_by_conn_op() which is used from ble_gattc_extract_first_by_conn_op() to accept max_procs and extract the appropriate number of procs, as required.
This commit is contained in:
committed by
Łukasz Rymanowski
parent
0644723fa7
commit
d4393d8e68
@@ -971,7 +971,7 @@ ble_gattc_extract_one(ble_gattc_match_fn *cb, void *arg)
|
||||
}
|
||||
|
||||
static void
|
||||
ble_gattc_extract_by_conn_op(uint16_t conn_handle, uint8_t op,
|
||||
ble_gattc_extract_by_conn_op(uint16_t conn_handle, uint8_t op, int max_procs,
|
||||
struct ble_gattc_proc_list *dst_list)
|
||||
{
|
||||
struct ble_gattc_criteria_conn_op criteria;
|
||||
@@ -979,7 +979,7 @@ ble_gattc_extract_by_conn_op(uint16_t conn_handle, uint8_t op,
|
||||
criteria.conn_handle = conn_handle;
|
||||
criteria.op = op;
|
||||
|
||||
ble_gattc_extract(ble_gattc_proc_matches_conn_op, &criteria, 0, dst_list);
|
||||
ble_gattc_extract(ble_gattc_proc_matches_conn_op, &criteria, max_procs, dst_list);
|
||||
}
|
||||
|
||||
static struct ble_gattc_proc *
|
||||
@@ -987,7 +987,7 @@ ble_gattc_extract_first_by_conn_op(uint16_t conn_handle, uint8_t op)
|
||||
{
|
||||
struct ble_gattc_proc_list dst_list;
|
||||
|
||||
ble_gattc_extract_by_conn_op(conn_handle, op, &dst_list);
|
||||
ble_gattc_extract_by_conn_op(conn_handle, op, 1, &dst_list);
|
||||
return STAILQ_FIRST(&dst_list);
|
||||
}
|
||||
|
||||
@@ -1076,7 +1076,7 @@ ble_gattc_fail_procs(uint16_t conn_handle, uint8_t op, int status)
|
||||
/* Remove all procs with the specified conn handle-op-pair and insert them
|
||||
* into the temporary list.
|
||||
*/
|
||||
ble_gattc_extract_by_conn_op(conn_handle, op, &temp_list);
|
||||
ble_gattc_extract_by_conn_op(conn_handle, op, 0, &temp_list);
|
||||
|
||||
/* Notify application of failed procedures and free the corresponding proc
|
||||
* entries.
|
||||
|
||||
Reference in New Issue
Block a user