rymanluk closed pull request #275: nimble/ll: Fix handling TERMINATE_IND as a
Master
URL: https://github.com/apache/mynewt-nimble/pull/275
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/nimble/controller/include/controller/ble_ll_conn.h
b/nimble/controller/include/controller/ble_ll_conn.h
index 38289a0b..8652a114 100644
--- a/nimble/controller/include/controller/ble_ll_conn.h
+++ b/nimble/controller/include/controller/ble_ll_conn.h
@@ -101,6 +101,7 @@ union ble_ll_conn_sm_flags {
uint32_t pkt_rxd:1;
uint32_t terminate_ind_txd:1;
uint32_t terminate_ind_rxd:1;
+ uint32_t terminate_ind_rxd_acked:1;
uint32_t allow_slave_latency:1;
uint32_t slave_set_last_anchor:1;
uint32_t awaiting_host_reply:1;
diff --git a/nimble/controller/src/ble_ll_conn.c
b/nimble/controller/src/ble_ll_conn.c
index abdd90c3..bd2e19b5 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -1410,6 +1410,9 @@ ble_ll_conn_tx_data_pdu(struct ble_ll_conn_sm *connsm)
/* Increment packets transmitted */
if (CONN_F_EMPTY_PDU_TXD(connsm)) {
+ if (connsm->csmflags.cfbit.terminate_ind_rxd) {
+ connsm->csmflags.cfbit.terminate_ind_rxd_acked = 1;
+ }
STATS_INC(ble_ll_conn_stats, tx_empty_pdus);
} else if ((hdr_byte & BLE_LL_DATA_HDR_LLID_MASK) == BLE_LL_LLID_CTRL)
{
STATS_INC(ble_ll_conn_stats, tx_ctrl_pdus);
@@ -2573,7 +2576,8 @@ ble_ll_conn_event_end(struct ble_npl_event *ev)
/* If we have transmitted the terminate IND successfully, we are done */
if ((connsm->csmflags.cfbit.terminate_ind_txd) ||
- (connsm->csmflags.cfbit.terminate_ind_rxd)) {
+ (connsm->csmflags.cfbit.terminate_ind_rxd &&
+ connsm->csmflags.cfbit.terminate_ind_rxd_acked)) {
if (connsm->csmflags.cfbit.terminate_ind_txd) {
ble_err = BLE_ERR_CONN_TERM_LOCAL;
} else {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services