diff --git a/lib/path.c b/lib/path.c index b63bbc8f1..8c4df33b8 100644 --- a/lib/path.c +++ b/lib/path.c @@ -197,15 +197,6 @@ int path_prepare(struct path *p) assert(p->state == STATE_CHECKED); -#ifdef WITH_HOOKS - int m = p->builtin ? HOOK_PATH | HOOK_BUILTIN : 0; - - /* Add internal hooks if they are not already in the list */ - ret = hook_list_prepare(&p->hooks, &p->signals, m, p, NULL); - if (ret) - return ret; -#endif /* WITH_HOOKS */ - /* Initialize destinations */ struct memory_type *pool_mt = &memory_hugepage; int pool_size = MAX(1, vlist_length(&p->destinations)) * p->queuelen; @@ -275,6 +266,16 @@ int path_prepare(struct path *p) } } +#ifdef WITH_HOOKS + int m = p->builtin ? HOOK_PATH | HOOK_BUILTIN : 0; + + /* Add internal hooks if they are not already in the list */ + ret = hook_list_prepare(&p->hooks, &p->signals, m, p, NULL); + if (ret) + return ret; +#endif /* WITH_HOOKS */ + + /* Initialize pool */ ret = pool_init(&p->pool, pool_size, SAMPLE_LENGTH(vlist_length(&p->signals)), pool_mt); if (ret) return ret; diff --git a/lib/super_node.cpp b/lib/super_node.cpp index e74c11bb0..16deb60bc 100644 --- a/lib/super_node.cpp +++ b/lib/super_node.cpp @@ -446,8 +446,8 @@ void SuperNode::stop() if (ret) throw RuntimeError("Failed to stop timer"); - stopPaths(); stopNodes(); + stopPaths(); stopNodeTypes(); stopInterfaces(); @@ -494,7 +494,7 @@ int SuperNode::periodic() started++; #ifdef WITH_HOOKS - hook_list_periodic(&p->hooks); + hook_list_periodic(&p->hooks); #endif /* WITH_HOOKS */ } } @@ -502,13 +502,12 @@ int SuperNode::periodic() for (size_t i = 0; i < vlist_length(&nodes); i++) { auto *n = (struct node *) vlist_at(&nodes, i); - if (n->state != STATE_STARTED) - continue; - + if (n->state == STATE_STARTED) { #ifdef WITH_HOOKS - hook_list_periodic(&n->in.hooks); - hook_list_periodic(&n->out.hooks); + hook_list_periodic(&n->in.hooks); + hook_list_periodic(&n->out.hooks); #endif /* WITH_HOOKS */ + } } if (idleStop && state == STATE_STARTED && started == 0) {