You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/07/24 22:32:17 UTC
[mynewt-nimble] 02/02: nimble/host: Fix initialization order
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit 4cb0c0561c4529f50a2ffdd9ac9987fc5ec2a1fd
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Jul 24 12:17:54 2019 +0200
nimble/host: Fix initialization order
Transport should be configured after default queue is set.
Callbacks set by host handle data by putting them on queue and use
event queue to notify host. If queue is not set (which can happen if
transport sends data immediately after callbacks are registered),
we'll have crash.
---
nimble/host/src/ble_hs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c
index c311847..c269636 100644
--- a/nimble/host/src/ble_hs.c
+++ b/nimble/host/src/ble_hs.c
@@ -781,15 +781,15 @@ ble_hs_init(void)
ble_hs_dbg_mutex_locked = 0;
#endif
- /* Configure the HCI transport to communicate with a host. */
- ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
-
#ifdef MYNEWT
ble_hs_evq_set((struct ble_npl_eventq *)os_eventq_dflt_get());
#else
ble_hs_evq_set(nimble_port_get_dflt_eventq());
#endif
+ /* Configure the HCI transport to communicate with a host. */
+ ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
+
#if BLE_MONITOR
rc = ble_monitor_init();
SYSINIT_PANIC_ASSERT(rc == 0);