You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ko...@apache.org on 2022/01/19 08:45:48 UTC
[mynewt-nimble] branch master updated: host/ble_gattc: Cancel prepered writes if data doesn't match in response
This is an automated email from the ASF dual-hosted git repository.
kopyscinski 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 30370ff host/ble_gattc: Cancel prepered writes if data doesn't match in response
30370ff is described below
commit 30370ffb57ac10e39b0124b6d5a103f260c1f0a5
Author: Krzysztof Kopyściński <kr...@codecoup.pl>
AuthorDate: Tue Jan 18 15:08:33 2022 +0100
host/ble_gattc: Cancel prepered writes if data doesn't match in response
If data received in ble_gattc_write_long_rx_prep() doesn't match
data sent in prepare write request we need not only return error in
function, but also send ATT_Execute_Write_Response with flag set to
BLE_ATT_EXEC_WRITE_F_CANCEL.
This is affecting GATT/CL/GAW/BI-32-C
---
nimble/host/src/ble_gattc.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/nimble/host/src/ble_gattc.c b/nimble/host/src/ble_gattc.c
index 74a2837..b43a0af 100644
--- a/nimble/host/src/ble_gattc.c
+++ b/nimble/host/src/ble_gattc.c
@@ -3765,17 +3765,20 @@ ble_gattc_write_long_rx_prep(struct ble_gattc_proc *proc,
proc->write_long.length) != 0) {
rc = BLE_HS_EBADDATA;
- goto err;
- }
- /* Send follow-up request. */
- proc->write_long.attr.offset += OS_MBUF_PKTLEN(om);
- rc = ble_gattc_write_long_resume(proc);
- if (rc != 0) {
+ /* if data doesn't match up send cancel write */
+ ble_att_clt_tx_exec_write(proc->conn_handle, BLE_ATT_EXEC_WRITE_F_CANCEL);
goto err;
- }
+ } else {
+ /* Send follow-up request. */
+ proc->write_long.attr.offset += OS_MBUF_PKTLEN(om);
+ rc = ble_gattc_write_long_resume(proc);
+ if (rc != 0) {
+ goto err;
+ }
- return 0;
+ return 0;
+ }
err:
/* XXX: Might need to cancel pending writes. */