nimble: fix send cancel pending writes on error Changed the cur_attr range check, because cur_attr is still 0 when first response is received.
With this patch it is possible to pass TC_GAW_CL_BI_32_C. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/4a9c7e6f Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4a9c7e6f Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4a9c7e6f Branch: refs/heads/develop Commit: 4a9c7e6fbc40243fa74af34784b0ed53fae2533c Parents: 48bce39 Author: MichaÅ Narajowski <[email protected]> Authored: Fri Dec 30 11:11:16 2016 +0100 Committer: MichaÅ Narajowski <[email protected]> Committed: Fri Dec 30 11:26:25 2016 +0100 ---------------------------------------------------------------------- net/nimble/host/pts/pts-gatt.txt | 3 ++- net/nimble/host/src/ble_gattc.c | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4a9c7e6f/net/nimble/host/pts/pts-gatt.txt ---------------------------------------------------------------------- diff --git a/net/nimble/host/pts/pts-gatt.txt b/net/nimble/host/pts/pts-gatt.txt index 8d08356..cee3522 100644 --- a/net/nimble/host/pts/pts-gatt.txt +++ b/net/nimble/host/pts/pts-gatt.txt @@ -336,7 +336,8 @@ TC_GAW_CL_BI_30_C PASS b conn peer_addr=<addr> b write long=1 conn=<handle> attr=<val_handle> value=aa b term conn=<handle> TC_GAW_CL_BI_31_C INC -TC_GAW_CL_BI_32_C INC +TC_GAW_CL_BI_32_C PASS b conn peer_addr=<addr> + b write conn=<handle> attr=<val_handle1> value=<val> attr=<val_handle2> value=<val> TC_GAW_CL_BI_33_C PASS b conn peer_addr=<addr> b write conn=<handle> attr=<val_handle> value=aa:bb b term conn=<handle> http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4a9c7e6f/net/nimble/host/src/ble_gattc.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c index c99facc..96c1d7c 100644 --- a/net/nimble/host/src/ble_gattc.c +++ b/net/nimble/host/src/ble_gattc.c @@ -4300,7 +4300,7 @@ ble_gattc_write_reliable_err(struct ble_gattc_proc *proc, int status, /* If we have successfully queued any data, and the failure occurred before * we could send the execute write command, then erase all queued data. */ - if (proc->write_reliable.cur_attr > 0 && + if (proc->write_reliable.cur_attr >= 0 && proc->write_reliable.cur_attr < proc->write_reliable.num_attrs) { exec_req.baeq_flags = BLE_ATT_EXEC_WRITE_F_CANCEL; @@ -4371,8 +4371,7 @@ ble_gattc_write_reliable_rx_prep(struct ble_gattc_proc *proc, return 0; err: - /* XXX: Might need to cancel pending writes. */ - ble_gattc_write_reliable_cb(proc, rc, 0); + ble_gattc_write_reliable_err(proc, rc, 0); return BLE_HS_EDONE; }
