linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Fix node reset
@ 2020-01-07 23:05 Michał Lowas-Rzechonek
  2020-01-08 17:13 ` Gix, Brian
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Lowas-Rzechonek @ 2020-01-07 23:05 UTC (permalink / raw)
  To: linux-bluetooth

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] mesh: Fix node reset
  2020-01-07 23:05 [PATCH BlueZ] mesh: Fix node reset Michał Lowas-Rzechonek
@ 2020-01-08 17:13 ` Gix, Brian
  0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2020-01-08 17:13 UTC (permalink / raw)
  To: michal.lowas-rzechonek, linux-bluetooth

Applied
On Wed, 2020-01-08 at 00:05 +0100, Michał Lowas-Rzechonek wrote:
> 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;
>  	}
>  

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-08 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-07 23:05 [PATCH BlueZ] mesh: Fix node reset Michał Lowas-Rzechonek
2020-01-08 17:13 ` Gix, Brian

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).