diff --git a/include/villas/hook.h b/include/villas/hook.h index bfc348ac1..2d81af6d4 100644 --- a/include/villas/hook.h +++ b/include/villas/hook.h @@ -70,9 +70,11 @@ int hook_parse(struct hook *h, json_t *cfg); int hook_destroy(struct hook *h); int hook_start(struct hook *h); + int hook_stop(struct hook *h); int hook_periodic(struct hook *h); + int hook_restart(struct hook *h); int hook_process(struct hook *h, struct sample *smps[], unsigned *cnt); diff --git a/include/villas/hook_type.h b/include/villas/hook_type.h index d7ff2f642..a7089af19 100644 --- a/include/villas/hook_type.h +++ b/include/villas/hook_type.h @@ -1,6 +1,6 @@ /** Hook funktions * - * Every path can register a hook function which is called for every received + * Every path or node can register a hook function which is called for every received * message. This can be used to debug the data flow, get statistics * or alter the message. * @@ -62,11 +62,11 @@ struct hook_type { int (*parse)(struct hook *h, json_t *cfg); - int (*init)(struct hook *h); /**< Called before path is started to parsed. */ + int (*init)(struct hook *h); /**< Called before hook is started to parsed. */ int (*destroy)(struct hook *h); /**< Called after path has been stopped to release memory allocated by HOOK_INIT */ - int (*start)(struct hook *h); /**< Called whenever a path is started; before threads are created. */ - int (*stop)(struct hook *h); /**< Called whenever a path is stopped; after threads are destoyed. */ + int (*start)(struct hook *h); /**< Called whenever a hook is started; before threads are created. */ + int (*stop)(struct hook *h); /**< Called whenever a hook is stopped; after threads are destoyed. */ int (*periodic)(struct hook *h);/**< Called periodically. Period is set by global 'stats' option in the configuration file. */ int (*restart)(struct hook *h); /**< Called whenever a new simulation case is started. This is detected by a sequence no equal to zero. */ diff --git a/lib/node.c b/lib/node.c index 5c6c7a838..a2248a843 100644 --- a/lib/node.c +++ b/lib/node.c @@ -331,9 +331,8 @@ int node_restart(struct node *n) info("Restarting node %s", node_name(n)); - if (node_type(n)->restart) { + if (node_type(n)->restart) ret = node_type(n)->restart(n); - } else { ret = node_type(n)->stop ? node_type(n)->stop(n) : 0; if (ret)