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.
This commit is contained in:
Andrzej Kaczmarek
2019-07-25 00:32:06 +02:00
parent 70142326fd
commit 4cb0c0561c
+3 -3
View File
@@ -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);