You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/06/21 08:50:35 UTC

[GitHub] michal-narajowski closed pull request #134: [RFC] mesh: Check if a model is subscribed to the destination address

michal-narajowski closed pull request #134: [RFC] mesh: Check if a model is subscribed to the destination address
URL: https://github.com/apache/mynewt-nimble/pull/134
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/nimble/host/mesh/src/access.c b/nimble/host/mesh/src/access.c
index 0850bcb0..66c49b58 100644
--- a/nimble/host/mesh/src/access.c
+++ b/nimble/host/mesh/src/access.c
@@ -390,7 +390,7 @@ static bool model_has_key(struct bt_mesh_model *mod, u16_t key)
 }
 
 static const struct bt_mesh_model_op *find_op(struct bt_mesh_model *models,
-					      u8_t model_count,
+					      u8_t model_count, u16_t dst,
 					      u16_t app_idx, u32_t opcode,
 					      struct bt_mesh_model **model)
 {
@@ -401,6 +401,13 @@ static const struct bt_mesh_model_op *find_op(struct bt_mesh_model *models,
 
 		*model = &models[i];
 
+		if (BT_MESH_ADDR_IS_GROUP(dst) ||
+		    BT_MESH_ADDR_IS_VIRTUAL(dst)) {
+			if (!bt_mesh_model_find_group(*model, dst)) {
+				continue;
+			}
+		}
+
 		if (!model_has_key(*model, app_idx)) {
 			continue;
 		}
@@ -494,11 +501,6 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf)
 			if (elem->addr != rx->dst) {
 				continue;
 			}
-		} else if (BT_MESH_ADDR_IS_GROUP(rx->dst) ||
-			   BT_MESH_ADDR_IS_VIRTUAL(rx->dst)) {
-			if (!bt_mesh_elem_find_group(elem, rx->dst)) {
-				continue;
-			}
 		} else if (i != 0 || !bt_mesh_fixed_group_match(rx->dst)) {
 			continue;
 		}
@@ -515,7 +517,7 @@ void bt_mesh_model_recv(struct bt_mesh_net_rx *rx, struct os_mbuf *buf)
 			count = elem->vnd_model_count;
 		}
 
-		op = find_op(models, count, rx->ctx.app_idx, opcode, &model);
+		op = find_op(models, count, rx->dst, rx->ctx.app_idx, opcode, &model);
 		if (op) {
 			struct net_buf_simple_state state;
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services