linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michał Lowas-Rzechonek" <michal.lowas-rzechonek@silvair.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] mesh: Fix node reset
Date: Wed,  8 Jan 2020 00:05:05 +0100	[thread overview]
Message-ID: <20200107230505.8087-1-michal.lowas-rzechonek@silvair.com> (raw)

Instead of stopping the daemon, just remove the node.

---
 mesh/cfgmod-server.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index 8acde95b9..bb43f01a0 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -740,9 +740,11 @@ static int hb_subscription_set(struct mesh_net *net, uint16_t src,
 
 static void node_reset(struct l_timeout *timeout, void *user_data)
 {
+	struct mesh_node *node = user_data;
+
 	l_debug("Node Reset");
 	l_timeout_remove(timeout);
-	l_main_quit();
+	node_remove(node);
 }
 
 static bool cfg_srv_pkt(uint16_t src, uint32_t dst, uint16_t unicast,
@@ -1265,7 +1267,11 @@ static bool cfg_srv_pkt(uint16_t src, uint32_t dst, uint16_t unicast,
 
 	case OP_NODE_RESET:
 		n = mesh_model_opcode_set(OP_NODE_RESET_STATUS, msg);
-		l_timeout_create(1, node_reset, net, NULL);
+		/*
+		 * delay node removal to give it a chance to send back the
+		 * status
+		 */
+		l_timeout_create(1, node_reset, node, NULL);
 		break;
 	}
 
-- 
2.23.0


             reply	other threads:[~2020-01-07 23:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 23:05 Michał Lowas-Rzechonek [this message]
2020-01-08 17:13 ` [PATCH BlueZ] mesh: Fix node reset Gix, Brian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200107230505.8087-1-michal.lowas-rzechonek@silvair.com \
    --to=michal.lowas-rzechonek@silvair.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).