You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2021/05/27 08:20:07 UTC

[mynewt-nimble] 29/31: mesh: Fix typos in flags/frags

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit a62a2e37cc8f05c69da825a790d8b3680667d8cb
Author: Krzysztof Kopyściński <kr...@codecoup.pl>
AuthorDate: Thu May 6 13:46:05 2021 +0200

    mesh: Fix typos in flags/frags
---
 nimble/host/mesh/src/adv.h    | 3 +++
 nimble/host/mesh/src/friend.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/adv.h b/nimble/host/mesh/src/adv.h
index 6566df9..38db786 100644
--- a/nimble/host/mesh/src/adv.h
+++ b/nimble/host/mesh/src/adv.h
@@ -35,6 +35,9 @@ typedef void (*bt_mesh_adv_func_t)(struct os_mbuf *buf, uint16_t duration,
 				   int err, void *user_data);
 
 struct bt_mesh_adv {
+
+	struct net_buf *frags;
+
 	const struct bt_mesh_send_cb *cb;
 	void *cb_data;
 
diff --git a/nimble/host/mesh/src/friend.c b/nimble/host/mesh/src/friend.c
index 5918ecf..354d31a 100644
--- a/nimble/host/mesh/src/friend.c
+++ b/nimble/host/mesh/src/friend.c
@@ -125,6 +125,7 @@ static void purge_buffers(struct net_buf_slist_t *list)
 	while (!net_buf_slist_is_empty(list)) {
 		struct os_mbuf *buf;
 		buf = (void *)net_buf_slist_get(list);
+		BT_MESH_ADV(buf)->frags = NULL;
 		BT_MESH_ADV(buf)->flags &= ~NET_BUF_FRAGS;
 		net_buf_unref(buf);
 	}
@@ -1235,7 +1236,7 @@ static void friend_timeout(struct ble_npl_event *work)
 
 	/* Clear the flag we use for segment tracking */
 	BT_MESH_ADV(frnd->last)->flags &= ~NET_BUF_FRAGS;
-	BT_MESH_ADV(frnd->last)->flags = 0;
+	BT_MESH_ADV(frnd->last)->frags = 0;
 
 	BT_DBG("Sending buf %p from Friend Queue of LPN 0x%04x",
 	       frnd->last, frnd->lpn);
@@ -1381,6 +1382,7 @@ static void friend_purge_old_ack(struct bt_mesh_friend *frnd, uint64_t *seq_auth
 
 			net_buf_slist_remove(&frnd->queue, prev, cur);
 			frnd->queue_size--;
+			BT_MESH_ADV(buf)->frags = 0;
 
 			net_buf_unref(buf);
 			break;
@@ -1622,6 +1624,7 @@ static bool friend_queue_prepare_space(struct bt_mesh_friend *frnd, uint16_t add
 		BT_DBG("PENDING SEGMENTS %d", pending_segments);
 
 		/* Make sure old slist entry state doesn't remain */
+		BT_MESH_ADV(buf)->frags = NULL;
 		BT_MESH_ADV(buf)->flags &= ~NET_BUF_FRAGS;
 
 		net_buf_unref(buf);