mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added option for skipping built-in hooks
This commit is contained in:
parent
88372ca1cd
commit
7ea7dad766
2 changed files with 16 additions and 12 deletions
|
@ -91,6 +91,7 @@ struct path {
|
|||
double rate; /**< A timeout for */
|
||||
int enabled; /**< Is this path enabled. */
|
||||
int reverse; /**< This path as a matching reverse path. */
|
||||
int no_builtin; /**< This path should not use built-in hooks by default. */
|
||||
int queuelen; /**< The queue length for each path_destination::queue */
|
||||
int samplelen; /**< Will be calculated based on path::sources.mappings */
|
||||
|
||||
|
|
27
lib/path.c
27
lib/path.c
|
@ -258,22 +258,24 @@ int path_init(struct path *p)
|
|||
p->queuelen = DEFAULT_QUEUELEN;
|
||||
|
||||
/* Add internal hooks if they are not already in the list */
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *q = (struct plugin *) list_at(&plugins, i);
|
||||
if (!p->no_builtin) {
|
||||
for (size_t i = 0; i < list_length(&plugins); i++) {
|
||||
struct plugin *q = (struct plugin *) list_at(&plugins, i);
|
||||
|
||||
if (q->type != PLUGIN_TYPE_HOOK)
|
||||
continue;
|
||||
if (q->type != PLUGIN_TYPE_HOOK)
|
||||
continue;
|
||||
|
||||
struct hook_type *vt = &q->hook;
|
||||
struct hook_type *vt = &q->hook;
|
||||
|
||||
if ((vt->flags & HOOK_PATH) && (vt->flags & HOOK_BUILTIN)) {
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
if ((vt->flags & HOOK_PATH) && (vt->flags & HOOK_BUILTIN)) {
|
||||
struct hook *h = (struct hook *) alloc(sizeof(struct hook));
|
||||
|
||||
ret = hook_init(h, vt, p, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = hook_init(h, vt, p, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
list_push(&p->hooks, h);
|
||||
list_push(&p->hooks, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,12 +392,13 @@ int path_parse(struct path *p, json_t *cfg, struct list *nodes)
|
|||
list_init(&sources);
|
||||
list_init(&destinations);
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: i, s?: s, s?: F, s?: o }",
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: o, s?: o, s?: o, s?: b, s?: b, s?: b, s?: i, s?: s, s?: F, s?: o }",
|
||||
"in", &json_in,
|
||||
"out", &json_out,
|
||||
"hooks", &json_hooks,
|
||||
"reverse", &p->reverse,
|
||||
"enabled", &p->enabled,
|
||||
"no_builtin", &p->no_builtin,
|
||||
"queuelen", &p->queuelen,
|
||||
"mode", &mode,
|
||||
"rate", &p->rate,
|
||||
|
|
Loading…
Add table
Reference in a new issue