From 514a5d1c914cd46229eb92e3669cf560ea29a559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Thu, 2 Nov 2017 15:35:48 +0100 Subject: [PATCH] mesh: Fix sending heartbeat only when relay state changes The heartbeat should only be sent in case the relay state actually changes. This fixes MESH/NODE/CFG/HBP/BV-03-C. X-Original-Commit: ed80ed41fbca1ed04c1e6813c6deb244b40ba76c --- nimble/host/mesh/src/cfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nimble/host/mesh/src/cfg.c b/nimble/host/mesh/src/cfg.c index 8e28d9c45..dc2426eaa 100644 --- a/nimble/host/mesh/src/cfg.c +++ b/nimble/host/mesh/src/cfg.c @@ -922,6 +922,7 @@ static void relay_set(struct bt_mesh_model *model, if (!cfg) { BT_WARN("No Configuration Server context available"); } else if (buf->om_data[0] == 0x00 || buf->om_data[0] == 0x01) { + bool change = (cfg->relay != buf->om_data[0]); struct bt_mesh_subnet *sub; cfg->relay = buf->om_data[0]; @@ -933,7 +934,7 @@ static void relay_set(struct bt_mesh_model *model, TRANSMIT_INT(cfg->relay_retransmit)); sub = bt_mesh_subnet_get(cfg->hb_pub.net_idx); - if ((cfg->hb_pub.feat & BT_MESH_FEAT_RELAY) && sub) { + if ((cfg->hb_pub.feat & BT_MESH_FEAT_RELAY) && sub && change) { hb_send(model); } } else {