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 2019/07/12 14:31:40 UTC

[mynewt-nimble] branch master updated: nimble/mesh: Increase transaction ID after sending unack message

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


The following commit(s) were added to refs/heads/master by this push:
     new 11dcd95  nimble/mesh: Increase transaction ID after sending unack message
11dcd95 is described below

commit 11dcd95667b8ac91bf4d995afd7279fcdcc2c116
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Fri Jul 12 13:46:46 2019 +0200

    nimble/mesh: Increase transaction ID after sending unack message
    
    UNACK messages are not retransmitted so we should increase TID
    after sending each message.
---
 nimble/host/mesh/src/model_cli.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/nimble/host/mesh/src/model_cli.c b/nimble/host/mesh/src/model_cli.c
index 68d4016..c9e9cf6 100644
--- a/nimble/host/mesh/src/model_cli.c
+++ b/nimble/host/mesh/src/model_cli.c
@@ -52,8 +52,6 @@ static void gen_onoff_status(struct bt_mesh_model *model,
 
 	BT_DBG("state: %d", state);
 
-	transaction_id++;
-
 	k_sem_give(&cli->op_sync);
 }
 
@@ -84,8 +82,6 @@ static void gen_level_status(struct bt_mesh_model *model,
 
 	BT_DBG("level: %d", level);
 
-	transaction_id++;
-
 	k_sem_give(&cli->op_sync);
 }
 
@@ -181,6 +177,9 @@ int bt_mesh_gen_onoff_set(u16_t net_idx, u16_t addr, u16_t app_idx,
 
 	err = cli_wait(&gen_onoff_cli, &param, OP_GEN_ONOFF_STATUS);
 done:
+	if (err == 0) {
+		transaction_id++;
+	}
 	os_mbuf_free_chain(msg);
 	return err;
 }
@@ -250,6 +249,9 @@ int bt_mesh_gen_level_set(u16_t net_idx, u16_t addr, u16_t app_idx,
 
 	err = cli_wait(&gen_level_cli, &param, OP_GEN_LEVEL_STATUS);
 done:
+	if (err == 0) {
+		transaction_id++;
+	}
 	os_mbuf_free_chain(msg);
 	return err;
 }