diff --git a/lib/hooks/stats_send.c b/lib/hooks/stats_send.c index 67a1f3163..40029f990 100644 --- a/lib/hooks/stats_send.c +++ b/lib/hooks/stats_send.c @@ -59,6 +59,8 @@ static int stats_send_parse(struct hook *h, config_setting_t *cfg) const char *dest, *mode; if (config_setting_lookup_string(cfg, "destination", &dest)) { + assert(h->path); + p->dest = list_lookup(&h->path->super_node->nodes, dest); if (!p->dest) cerror(cfg, "Invalid destination node '%s' for hook '%s'", dest, plugin_name(h->_vt)); diff --git a/lib/super_node.c b/lib/super_node.c index a47f6f371..63ed40879 100644 --- a/lib/super_node.c +++ b/lib/super_node.c @@ -249,8 +249,6 @@ int super_node_parse(struct super_node *sn, config_setting_t *cfg) struct node *n = alloc(sizeof(struct node)); - n->state = STATE_DESTROYED; - ret = node_init(n, &p->node); if (ret) cerror(cfg_node, "Failed to initialize node"); diff --git a/src/hook.c b/src/hook.c index 59a394191..f36821f1d 100644 --- a/src/hook.c +++ b/src/hook.c @@ -153,6 +153,7 @@ int main(int argc, char *argv[]) config_init(&cfg); + /** @todo villas-hook does not use the path structure */ ret = hook_init(&h, &p->hook, NULL); if (ret) error("Failed to initialize hook"); diff --git a/src/node.c b/src/node.c index 8a355c112..ffc63fca4 100644 --- a/src/node.c +++ b/src/node.c @@ -47,14 +47,20 @@ struct super_node sn; static void quit(int signal, siginfo_t *sinfo, void *ctx) { + int ret; + if (sn.stats > 0) stats_print_footer(STATS_FORMAT_HUMAN); - super_node_stop(&sn); - super_node_destroy(&sn); + ret = super_node_stop(&sn); + if (ret) + error("Failed to stop super node"); + + ret = super_node_destroy(&sn); + if (ret) + error("Failed to destroy super node"); info(CLR_GRN("Goodbye!")); - exit(EXIT_SUCCESS); } diff --git a/src/pipe.c b/src/pipe.c index 8e9e26b9d..72d68bf8d 100644 --- a/src/pipe.c +++ b/src/pipe.c @@ -192,7 +192,6 @@ static void * recv_loop(void *ctx) leave: info("Reached receive limit. Terminating..."); killme(SIGTERM); - return NULL; return NULL; }