|
|
@@ -185,7 +185,8 @@ static s32_t bt_mesh_client_calc_timeout(struct bt_mesh_msg_ctx *ctx,
|
|
|
need_seg = true; /* Needs segmentation */
|
|
|
}
|
|
|
|
|
|
- mic_size = (need_seg && net_buf_simple_tailroom(msg) >= 8U) ? 8U : 4U;
|
|
|
+ mic_size = (need_seg && net_buf_simple_tailroom(msg) >= BLE_MESH_MIC_LONG) ?
|
|
|
+ BLE_MESH_MIC_LONG : BLE_MESH_MIC_SHORT;
|
|
|
|
|
|
if (need_seg) {
|
|
|
/* Based on the message length, calculate how many segments are needed.
|
|
|
@@ -201,17 +202,14 @@ static s32_t bt_mesh_client_calc_timeout(struct bt_mesh_msg_ctx *ctx,
|
|
|
* messages, but if there are other messages between any two retrans-
|
|
|
* missions of the same segmented messages, then the whole time will
|
|
|
* be longer.
|
|
|
+ *
|
|
|
+ * Since the transport behavior has been changed, i.e. start retransmit
|
|
|
+ * timer after the last segment is sent, so we can simplify the timeout
|
|
|
+ * calculation here. And the retransmit timer will be started event if
|
|
|
+ * the attempts reaches ZERO when the dst is a unicast address.
|
|
|
*/
|
|
|
- if (duration + HCI_TIME_FOR_START_ADV < seg_retrans_to) {
|
|
|
- s32_t seg_duration = seg_count * (duration + HCI_TIME_FOR_START_ADV);
|
|
|
- time = (seg_duration + seg_retrans_to) * (seg_retrans_num - 1) + seg_duration;
|
|
|
- } else {
|
|
|
- /* If the duration is bigger than the segment retransmit timeout
|
|
|
- * value. In this situation, the segment retransmit timeout value
|
|
|
- * may need to be optimized based on the "Network Transmit" value.
|
|
|
- */
|
|
|
- time = seg_count * (duration + HCI_TIME_FOR_START_ADV) * seg_retrans_num;
|
|
|
- }
|
|
|
+ s32_t seg_duration = seg_count * (duration + HCI_TIME_FOR_START_ADV);
|
|
|
+ time = (seg_duration + seg_retrans_to) * seg_retrans_num;
|
|
|
|
|
|
BT_INFO("Original timeout %dms, calculated timeout %dms", timeout, time);
|
|
|
|