summaryrefslogtreecommitdiff
path: root/mesh/cfgmod-server.c
diff options
context:
space:
mode:
authorInga Stotland <inga.stotland@intel.com>2020-03-17 15:15:46 -0700
committerBrian Gix <brian.gix@intel.com>2020-03-18 09:20:28 -0700
commit5885eab5bd87ba5fc6eda34255ebac1e07e47611 (patch)
tree565b645e035822aaf5c7c6e127a9e226fc3e62ce /mesh/cfgmod-server.c
parentfe43810b78577ef0cc72156e5f462d9977daf2c1 (diff)
downloadbluez-5885eab5bd87ba5fc6eda34255ebac1e07e47611.tar.gz
mesh: Fix processing of Config Node Reset message
This fixes a condition when a node continues processing messages after it has been reset by a remote configuration client. Upon receiving Config Node Reset message, node removal happens after a grace interval to allow sending of Config Node Reset Status reply.
Diffstat (limited to 'mesh/cfgmod-server.c')
-rw-r--r--mesh/cfgmod-server.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/mesh/cfgmod-server.c b/mesh/cfgmod-server.c
index a1f682765..8db2ef43c 100644
--- a/mesh/cfgmod-server.c
+++ b/mesh/cfgmod-server.c
@@ -695,12 +695,11 @@ static int hb_subscription_set(struct mesh_net *net, uint16_t src,
return MESH_STATUS_SUCCESS;
}
-static void node_reset(struct l_timeout *timeout, void *user_data)
+static void node_reset(void *user_data)
{
struct mesh_node *node = user_data;
l_debug("Node Reset");
- l_timeout_remove(timeout);
node_remove(node);
}
@@ -1223,20 +1222,17 @@ static bool cfg_srv_pkt(uint16_t src, uint16_t dst, uint16_t app_idx,
case OP_NODE_RESET:
n = mesh_model_opcode_set(OP_NODE_RESET_STATUS, msg);
- /*
- * Delay node removal to give it a chance to send back the
- * status
- */
- l_timeout_create(1, node_reset, node, NULL);
+
+ /* Delay node removal to give it a chance to send the status */
+ l_idle_oneshot(node_reset, node, NULL);
break;
}
- if (n) {
- /* print_packet("App Tx", long_msg ? long_msg : msg, n); */
+ if (n)
mesh_model_send(node, dst, src,
APP_IDX_DEV_LOCAL, net_idx, DEFAULT_TTL,
long_msg ? long_msg : msg, n);
- }
+
l_free(long_msg);
return true;