diff --git a/include/path.h b/include/path.h index a96b2fd05..d5ba79038 100644 --- a/include/path.h +++ b/include/path.h @@ -27,8 +27,8 @@ enum path_state */ struct path { - struct node *in; - struct node *out[MAX_NODES]; + /// Pointers to the incoming and outgoing node + struct node *in, *out; /// Hooks are called for every message which is passed int (*hooks[MAX_HOOKS])(struct msg *m); @@ -61,7 +61,7 @@ struct path * - a pointer to the new path on success * - NULL if an error occured */ -struct path* path_create(struct node *in, struct node *out[], int len); +struct path* path_create(struct node *in, struct node *out); /** * @brief Delete a path created by path_create() diff --git a/src/path.c b/src/path.c index 5b0cdbaea..60b08b716 100644 --- a/src/path.c +++ b/src/path.c @@ -8,21 +8,21 @@ #include #include #include +#include #include "utils.h" #include "path.h" -struct path* path_create(struct node *in, struct node *out[], int len) +struct path* path_create(struct node *in, struct node *out) { struct path *p = malloc(sizeof(struct path)); if (!p) return NULL; - p->in = in; + memset(p, 0, sizeof(struct path)); - for (int i = 0; i < len; i++) { - p->out[i] = out[i]; - } + p->in = in; + p->out = out; return p; } @@ -44,8 +44,7 @@ static void * path_run(void *arg) pfd.fd = p->in->sd; pfd.events = POLLIN; - // TODO: add support for multiple outgoing nodes - print(DEBUG, "Established path: %12s => %s => %-12s", p->in->name, NAME, p->out[0]->name); + print(DEBUG, "Established path: %12s => %s => %-12s", p->in->name, NAME, p->out->name); /* main thread loop */ while (p->state == RUNNING) {