From 4bf2ceee4ed178146d5a8845db6a2f8d8ea28c4f Mon Sep 17 00:00:00 2001 From: lly Date: Thu, 24 Oct 2019 16:10:35 +0800 Subject: [PATCH] ble_mesh: Skip local messages in rx Local messages are already enqueued for the LPN in the tx path, and don't have to be added again in the rx path. --- components/bt/esp_ble_mesh/mesh_core/friend.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/bt/esp_ble_mesh/mesh_core/friend.c b/components/bt/esp_ble_mesh/mesh_core/friend.c index a7b96d61ea..2531e4171e 100644 --- a/components/bt/esp_ble_mesh/mesh_core/friend.c +++ b/components/bt/esp_ble_mesh/mesh_core/friend.c @@ -1310,6 +1310,14 @@ static void friend_lpn_enqueue_rx(struct bt_mesh_friend *frnd, struct friend_pdu_info info; struct net_buf *buf; + /* Because of network loopback, tx packets will also be passed into + * this rx function. These packets have already been added to the + * queue, and should be ignored. + */ + if (bt_mesh_elem_find(rx->ctx.addr)) { + return; + } + BT_DBG("LPN 0x%04x queue_size %u", frnd->lpn, frnd->queue_size); if (type == BLE_MESH_FRIEND_PDU_SINGLE && seq_auth) {