Bluetooth: Mesh: Avoid indefinite timeout when duration less than zero
`struct bt_le_ext_adv_start_param.timeout` resolution is in 10ms. When duration is less than 10ms, division will be evaluated to zero, which will result in indefinite timeout. Set timeout to 10ms to avoid indefinite timeout. The advertisement will end earlier anyway after the event is finished. Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
This commit is contained in:
parent
55c4e06b35
commit
326786efd6
1 changed files with 1 additions and 1 deletions
|
@ -417,7 +417,7 @@ int bt_mesh_adv_gatt_start(const struct bt_le_adv_param *param,
|
|||
struct bt_mesh_ext_adv *adv = gatt_adv_get();
|
||||
struct bt_le_ext_adv_start_param start = {
|
||||
/* Timeout is set in 10 ms steps, with 0 indicating "forever" */
|
||||
.timeout = (duration == SYS_FOREVER_MS) ? 0 : (duration / 10),
|
||||
.timeout = (duration == SYS_FOREVER_MS) ? 0 : MAX(1, duration / 10),
|
||||
};
|
||||
|
||||
BT_DBG("Start advertising %d ms", duration);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue