return true;
}
-void mesh_config_destroy(struct mesh_config *cfg)
+void mesh_config_destroy_nvm(struct mesh_config *cfg)
{
char *node_dir, *node_name;
char uuid[33];
return;
del_path(node_dir);
-
- /* Release node config object */
- mesh_config_release(cfg);
}
bool mesh_config_load_nodes(const char *cfgdir_name, mesh_config_node_func_t cb,
void *user_data);
void mesh_config_release(struct mesh_config *cfg);
-void mesh_config_destroy(struct mesh_config *cfg);
+void mesh_config_destroy_nvm(struct mesh_config *cfg);
bool mesh_config_save(struct mesh_config *cfg, bool no_wait,
mesh_config_status_func_t cb, void *user_data);
struct mesh_config *mesh_config_create(const char *cfgdir_name,
struct mesh_node *node = data;
/* Unregister io callbacks */
- if (node->net)
- mesh_net_detach(node->net);
+ mesh_net_detach(node->net);
- l_queue_destroy(node->elements, element_free);
- node->elements = NULL;
/* In case of a provisioner, stop active scanning */
if (node->provisioner)
manager_scan_cancel(node);
+ /* Free dynamic resources */
free_node_dbus_resources(node);
-
+ l_queue_destroy(node->elements, element_free);
mesh_config_release(node->cfg);
mesh_net_free(node->net);
l_free(node->storage_dir);
l_queue_remove(nodes, node);
- if (node->cfg)
- mesh_config_destroy(node->cfg);
+ mesh_config_destroy_nvm(node->cfg);
free_node_resources(node);
}
static void cleanup_node(void *data)
{
struct mesh_node *node = data;
- struct mesh_net *net = node->net;
+ uint32_t seq_num = mesh_net_get_seq_num(node->net);
- /* Preserve the last sequence number */
- if (node->cfg)
- mesh_config_write_seq_number(node->cfg,
- mesh_net_get_seq_num(net),
- false);
+ /* Preserve the last used sequence number */
+ mesh_config_write_seq_number(node->cfg, seq_num, false);
free_node_resources(node);
}