From f2521657a2bac0d71d60a77eaaba352344941a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Rymanowski?= Date: Wed, 17 Apr 2019 10:50:13 +0200 Subject: [PATCH] nimble/ll: Make sure to ACK Terminate IND with empty packet --- nimble/controller/src/ble_ll_conn.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nimble/controller/src/ble_ll_conn.c b/nimble/controller/src/ble_ll_conn.c index 5cdc3c585..2bf509881 100644 --- a/nimble/controller/src/ble_ll_conn.c +++ b/nimble/controller/src/ble_ll_conn.c @@ -839,7 +839,7 @@ ble_ll_conn_tx_data_pdu(struct ble_ll_conn_sm *connsm) uint32_t ticks; struct os_mbuf *m; struct ble_mbuf_hdr *ble_hdr; - struct os_mbuf_pkthdr *pkthdr; + struct os_mbuf_pkthdr *pkthdr = NULL; struct os_mbuf_pkthdr *nextpkthdr; struct ble_ll_empty_pdu empty_pdu; ble_phy_tx_end_func txend_func; @@ -851,6 +851,14 @@ ble_ll_conn_tx_data_pdu(struct ble_ll_conn_sm *connsm) md = 0; hdr_byte = BLE_LL_LLID_DATA_FRAG; + if (connsm->csmflags.cfbit.terminate_ind_rxd) { + /* We just received terminate indication. + * Just sent empty packet as an ACK + */ + CONN_F_EMPTY_PDU_TXD(connsm) = 1; + goto conn_tx_pdu; + } + /* * We need to check if we are retrying a pdu or if there is a pdu on * the transmit queue.