Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 28df4dd62 -> 353876573
MYNEWT-698: Unhandled exception in controller in ble_ll_conn_end The controller was generating an unhandled exception inside the function ble_ll_conn_end. This was occurring when the controller was scheduling a new connection (master role) but no mbufs were available to hand the received pdu to the link layer task. The code attempts to schedule a master role connection and send a connection request prior to allocating a receive buffer for the received advertising pdu. It does this to save time since we need all the time available from when the advertising pdu is received until the time we need to send the connect request. I am not terribly pleased with the fix since it is inefficient. However, I wanted to get a fix in now. A better way might not be to re-enable scanning or initiating unless a buffer is available for receive but that change would be a bit more work. 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/35387657 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/35387657 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/35387657 Branch: refs/heads/develop Commit: 3538765730aa8aaa1b49fd4a2b3a263272bcff4f Parents: 28df4dd Author: William San Filippo <[email protected]> Authored: Wed Mar 29 20:47:49 2017 -0700 Committer: William San Filippo <[email protected]> Committed: Wed Mar 29 20:47:49 2017 -0700 ---------------------------------------------------------------------- net/nimble/controller/src/ble_ll_conn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/35387657/net/nimble/controller/src/ble_ll_conn.c ---------------------------------------------------------------------- diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c index d8d3f8f..0ca72d0 100644 --- a/net/nimble/controller/src/ble_ll_conn.c +++ b/net/nimble/controller/src/ble_ll_conn.c @@ -2258,6 +2258,9 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok, struct os_mbuf *rxpdu; struct ble_ll_conn_sm *connsm; + /* Get connection state machine to use if connection to be established */ + connsm = g_ble_ll_conn_create_sm; + /* * We have to restart receive if we cant hand up pdu. We return 0 so that * the phy does not get disabled. @@ -2268,9 +2271,6 @@ ble_ll_init_rx_isr_end(uint8_t *rxbuf, uint8_t crcok, goto init_rx_isr_exit; } - /* Get connection state machine to use if connection to be established */ - connsm = g_ble_ll_conn_create_sm; - /* Only interested in ADV IND or ADV DIRECT IND */ pdu_type = rxbuf[0] & BLE_ADV_PDU_HDR_TYPE_MASK; inita_is_rpa = 0;
