ble_mesh: fix resending segments on correct bearer

pull/4085/head
lly 2019-09-02 15:03:42 +08:00
rodzic 6f7b7c552d
commit ff6cb921c3
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -731,6 +731,7 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
{
const u8_t *enc, *priv;
u32_t seq;
u16_t dst;
int err;
BT_DBG("net_idx 0x%04x new_key %u len %u", sub->net_idx, new_key,
@ -757,6 +758,9 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
buf->data[3] = seq >> 8;
buf->data[4] = seq;
/* Get destination, in case it's a proxy client */
dst = DST(buf->data);
err = bt_mesh_net_encrypt(enc, &buf->b, BLE_MESH_NET_IVI_TX, false);
if (err) {
BT_ERR("%s, Encrypt failed (err %d)", __func__, err);
@ -769,7 +773,12 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
return err;
}
bt_mesh_adv_send(buf, cb, cb_data);
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY) &&
bt_mesh_proxy_relay(&buf->b, dst)) {
net_buf_unref(buf);
} else {
bt_mesh_adv_send(buf, cb, cb_data);
}
if (!bt_mesh_atomic_test_bit(bt_mesh.flags, BLE_MESH_IVU_IN_PROGRESS) &&
bt_mesh.seq > IV_UPDATE_SEQ_LIMIT) {