diff --git a/nimble/host/src/ble_hs.c b/nimble/host/src/ble_hs.c index d819e20df..651bff265 100644 --- a/nimble/host/src/ble_hs.c +++ b/nimble/host/src/ble_hs.c @@ -830,4 +830,8 @@ ble_hs_deinit(void) ble_gap_deinit(); ble_hs_hci_deinit(); + + ble_hs_flow_stop(); + + ble_hs_stop_deinit(); } diff --git a/nimble/host/src/ble_hs_flow.c b/nimble/host/src/ble_hs_flow.c index 2520c8541..3df8c02d5 100644 --- a/nimble/host/src/ble_hs_flow.c +++ b/nimble/host/src/ble_hs_flow.c @@ -273,3 +273,11 @@ ble_hs_flow_startup(void) return 0; } + +void +ble_hs_flow_stop(void) +{ +#if MYNEWT_VAL(BLE_HS_FLOW_CTRL) + ble_npl_callout_deinit(&ble_hs_flow_timer); +#endif +} diff --git a/nimble/host/src/ble_hs_flow_priv.h b/nimble/host/src/ble_hs_flow_priv.h index 753eaf8ff..291849a72 100644 --- a/nimble/host/src/ble_hs_flow_priv.h +++ b/nimble/host/src/ble_hs_flow_priv.h @@ -28,7 +28,7 @@ extern "C" { void ble_hs_flow_connection_broken(uint16_t conn_handle); void ble_hs_flow_track_data_mbuf(struct os_mbuf *om); int ble_hs_flow_startup(void); - +void ble_hs_flow_stop(void); #ifdef __cplusplus } #endif diff --git a/nimble/host/src/ble_hs_priv.h b/nimble/host/src/ble_hs_priv.h index 538d07a97..0034fbae4 100644 --- a/nimble/host/src/ble_hs_priv.h +++ b/nimble/host/src/ble_hs_priv.h @@ -132,6 +132,7 @@ void ble_hs_timer_resched(void); void ble_hs_notifications_sched(void); struct ble_npl_eventq *ble_hs_evq_get(void); void ble_hs_stop_init(void); +void ble_hs_stop_deinit(void); struct ble_mqueue { STAILQ_HEAD(, os_mbuf_pkthdr) head; diff --git a/nimble/host/src/ble_hs_stop.c b/nimble/host/src/ble_hs_stop.c index b90d3ec6f..c34e5f610 100644 --- a/nimble/host/src/ble_hs_stop.c +++ b/nimble/host/src/ble_hs_stop.c @@ -281,3 +281,9 @@ ble_hs_stop_init(void) ble_hs_stop_terminate_timeout_cb, NULL); #endif } + +void +ble_hs_stop_deinit(void) +{ + ble_npl_callout_deinit(&ble_hs_stop_terminate_tmo); +}