You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2018/12/07 15:03:47 UTC

[mynewt-nimble] branch master updated: nimble/gatt: Fix the issue of removing multiple procs having same opcode

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new d4393d8  nimble/gatt: Fix the issue of removing multiple procs having same opcode
d4393d8 is described below

commit d4393d8e68fa3bd49b6cb5326ca91b462ca0933a
Author: Hrishikesh Dhayagude <hr...@espressif.com>
AuthorDate: Fri Nov 30 19:04:30 2018 +0530

    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.
---
 nimble/host/src/ble_gattc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nimble/host/src/ble_gattc.c b/nimble/host/src/ble_gattc.c
index 2a55b9d..a6ae147 100644
--- a/nimble/host/src/ble_gattc.c
+++ b/nimble/host/src/ble_gattc.c
@@ -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.