You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2019/10/15 12:33:28 UTC
[mynewt-nimble] 02/04: nimble/ll: Reset backoff only when sending
scan request
This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 8307ce6f2cf217de77c6fd34b1b1c082e02e91d6
Author: Szymon Janc <sz...@codecoup.pl>
AuthorDate: Tue Oct 8 10:29:15 2019 +0200
nimble/ll: Reset backoff only when sending scan request
Don't decrement backoff if we failed to send scan request.
---
nimble/controller/src/ble_ll_scan.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/nimble/controller/src/ble_ll_scan.c b/nimble/controller/src/ble_ll_scan.c
index c417a92..3ccc888 100644
--- a/nimble/controller/src/ble_ll_scan.c
+++ b/nimble/controller/src/ble_ll_scan.c
@@ -265,6 +265,8 @@ ble_ll_scan_ext_adv_init(struct ble_ll_aux_data **aux_data)
static void
ble_ll_scan_req_backoff(struct ble_ll_scan_sm *scansm, int success)
{
+ BLE_LL_ASSERT(scansm->backoff_count == 0);
+
scansm->scan_rsp_pending = 0;
if (success) {
scansm->scan_rsp_cons_fails = 0;
@@ -2467,7 +2469,10 @@ ble_ll_scan_rx_isr_end(struct os_mbuf *rxpdu, uint8_t crcok)
BLE_LL_ASSERT(scansm->scan_rsp_pending == 0);
/* We want to send a request. See if backoff allows us */
- --scansm->backoff_count;
+ if (scansm->backoff_count > 0) {
+ scansm->backoff_count--;
+ }
+
if (scansm->backoff_count == 0) {
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_EXT_ADV)
phy_mode = ble_ll_phy_to_phy_mode(ble_hdr->rxinfo.phy,