host/mesh: fix mesh advertising thread

Cleans up `bt_mesh_adv_queue` after sync
This commit is contained in:
Krzysztof Kopyściński
2021-11-10 06:24:00 +01:00
committed by Krzysztof Kopyściński
parent 6f6fc995e5
commit 5b71db8b5d
4 changed files with 9 additions and 8 deletions
+2 -1
View File
@@ -36,7 +36,8 @@ const uint8_t bt_mesh_adv_type[BT_MESH_ADV_TYPES] = {
extern uint8_t g_mesh_addr_type;
struct os_mbuf_pool adv_os_mbuf_pool;
static struct ble_npl_eventq bt_mesh_adv_queue;
struct ble_npl_eventq bt_mesh_adv_queue;
static struct bt_mesh_adv adv_pool[CONFIG_BT_MESH_ADV_BUF_COUNT];
static struct bt_mesh_adv *adv_alloc(int id)
+1
View File
@@ -29,6 +29,7 @@
/* We declare it as extern here to share it between 'adv' and 'adv_legacy' */
extern struct os_mbuf_pool adv_os_mbuf_pool;
extern struct ble_npl_eventq bt_mesh_adv_queue;
enum bt_mesh_adv_type
{
+1 -1
View File
@@ -28,7 +28,7 @@ static struct ble_gap_ext_adv_params adv_param = {
};
bool ext_adv_configured = false;
static struct ble_npl_eventq bt_mesh_adv_queue;
struct ble_npl_eventq bt_mesh_adv_queue;
enum {
/** Controller is currently advertising */
+5 -6
View File
@@ -48,7 +48,6 @@ static os_membuf_t adv_buf_mem[OS_MEMPOOL_SIZE(
MYNEWT_VAL(BLE_MESH_ADV_BUF_COUNT),
BT_MESH_ADV_DATA_SIZE + BT_MESH_MBUF_HEADER_SIZE)];
static struct os_mempool adv_buf_mempool;
static struct ble_npl_eventq adv_queue;
static inline void adv_send(struct os_mbuf *buf)
{
@@ -143,7 +142,7 @@ mesh_adv_thread(void *args)
while (1) {
#if (MYNEWT_VAL(BLE_MESH_PROXY))
ev = ble_npl_eventq_get(&adv_queue, 0);
ev = ble_npl_eventq_get(&bt_mesh_adv_queue, 0);
while (!ev) {
if (bt_mesh_is_provisioned()) {
if (IS_ENABLED(CONFIG_BT_MESH_GATT_PROXY)) {
@@ -160,11 +159,11 @@ mesh_adv_thread(void *args)
timeout = ble_npl_time_ms_to_ticks32(timeout);
}
ev = ble_npl_eventq_get(&adv_queue, timeout);
ev = ble_npl_eventq_get(&bt_mesh_adv_queue, timeout);
bt_le_adv_stop();
}
#else
ev = ble_npl_eventq_get(&adv_queue, BLE_NPL_TIME_FOREVER);
ev = ble_npl_eventq_get(&bt_mesh_adv_queue, BLE_NPL_TIME_FOREVER);
#endif
if (!ev || !ble_npl_event_get_arg(ev)) {
@@ -191,7 +190,7 @@ void bt_mesh_adv_update(void)
BT_DBG("");
ble_npl_eventq_put(&adv_queue, &ev);
ble_npl_eventq_put(&bt_mesh_adv_queue, &ev);
}
void bt_mesh_adv_buf_ready(void)
@@ -219,7 +218,7 @@ void bt_mesh_adv_init(void)
MYNEWT_VAL(BLE_MESH_ADV_BUF_COUNT));
assert(rc == 0);
ble_npl_eventq_init(&adv_queue);
ble_npl_eventq_init(&bt_mesh_adv_queue);
#if MYNEWT
os_task_init(&adv_task, "mesh_adv", mesh_adv_thread, NULL,