mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-28 11:47:23 +00:00
msh: Permit model walk from any model
Fixes bug where applications that disable model extensions end up in an infinite loop, and adds support for walking model subtrees, as opposed to forcing root to be unextended. this is port of a878b36af0ef7c311d0f10cc9f1771078de378fb
This commit is contained in:
committed by
Łukasz Rymanowski
parent
a02cb16190
commit
0beffcd022
@@ -803,7 +803,7 @@ void bt_mesh_model_tree_walk(struct bt_mesh_model *root,
|
||||
void *user_data)
|
||||
{
|
||||
struct bt_mesh_model *m = root;
|
||||
uint32_t depth = 0;
|
||||
int depth = 0;
|
||||
/* 'skip' is set to true when we ascend from child to parent node.
|
||||
* In that case, we want to skip calling the callback on the parent
|
||||
* node and we don't want to descend onto a child node as those
|
||||
@@ -812,7 +812,8 @@ void bt_mesh_model_tree_walk(struct bt_mesh_model *root,
|
||||
bool skip = false;
|
||||
|
||||
do {
|
||||
if (!skip && cb(m, depth, user_data) == BT_MESH_WALK_STOP) {
|
||||
if (!skip &&
|
||||
cb(m, (uint32_t)depth, user_data) == BT_MESH_WALK_STOP) {
|
||||
return;
|
||||
}
|
||||
#if MYNEWT_VAL(BLE_MESH_MODEL_EXTENSIONS)
|
||||
@@ -828,7 +829,7 @@ void bt_mesh_model_tree_walk(struct bt_mesh_model *root,
|
||||
skip = false;
|
||||
}
|
||||
#endif
|
||||
} while (m);
|
||||
} while (m && depth > 0);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_MESH_MODEL_EXTENSIONS)
|
||||
|
||||
Reference in New Issue
Block a user