You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by gi...@git.apache.org on 2017/09/20 10:17:32 UTC
[GitHub] sjanc commented on a change in pull request #563: Mesh qualification improvements
sjanc commented on a change in pull request #563: Mesh qualification improvements
URL: https://github.com/apache/mynewt-core/pull/563#discussion_r139928167
##########
File path: net/nimble/host/mesh/src/net.c
##########
@@ -789,26 +789,37 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct os_mbuf *buf,
/* Deliver to GATT Proxy Clients if necessary */
if ((MYNEWT_VAL(BLE_MESH_GATT_PROXY))) {
if (bt_mesh_proxy_relay(buf, tx->ctx->addr) &&
- BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
+ BT_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
err = 0;
goto done;
}
}
#if (MYNEWT_VAL(BLE_MESH_LOCAL_INTERFACE))
/* Deliver to local network interface if necessary */
- if (bt_mesh_fixed_group_match(tx->ctx->addr) ||
- bt_mesh_elem_find(tx->ctx->addr)) {
- net_buf_put(&bt_mesh.local_queue, net_buf_ref(buf));
- if (cb) {
- cb(buf, 0);
- }
- k_work_submit(&bt_mesh.local_work);
+ if (bt_mesh_fixed_group_match(tx->ctx->addr)) {
+ bt_mesh_adv_send(buf, cb);
+ goto local;
+ }
+
+ if (bt_mesh_elem_find(tx->ctx->addr)) {
+ goto local;
} else {
bt_mesh_adv_send(buf, cb);
+ goto local_done;
}
-#else
- bt_mesh_adv_send(buf, cb);
+
+local:
+ net_buf_put(&bt_mesh.local_queue, net_buf_ref(buf));
+ if (cb) {
+ cb(buf, 0);
+ }
+ k_work_submit(&bt_mesh.local_work);
+
+local_done:
+
+#elif
+ bt_mesh_adv_send(buf, cb);
Review comment:
if (bt_mesh_fixed_group_match(tx->ctx->addr)) {
bt_mesh_adv_send(buf, cb);
} else if (!bt_mesh_elem_find(tx->ctx->addr)) {
bt_mesh_adv_send(buf, cb);
goto done;
}
}
net_buf_put(&bt_mesh.local_queue, net_buf_ref(buf));
if (cb) {
cb(buf, 0);
}
k_work_submit(&bt_mesh.local_work);
done:
this requires only 1 label, you may also use local variable is_local and set it properly in if-elseif and then use it to decide if cb should be called
----------------------------------------------------------------
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