From cc144cdc8a1a6705f22b36c1cf49798bc71c7b8a Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Thu, 5 Jun 2014 09:34:38 +0000 Subject: [PATCH] added hooks and some tests to the path code git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@11 8ec27952-4edc-4aab-86aa-e87bb2611832 --- src/path.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/path.c b/src/path.c index 60b08b716..f1b1a52ff 100644 --- a/src/path.c +++ b/src/path.c @@ -55,11 +55,12 @@ static void * path_run(void *arg) node_recv(p->in, &m); /* call hooks */ + for (int i = 0; i < MAX_HOOKS && p->hooks[i]; i++) { + p->hooks[i](&m); + } /* send messages */ - /*for (struct node **n = p->out; *n; n++) { - node_send(*n, &m); - }*/ + node_send(p->out, &m); } return NULL; @@ -67,6 +68,9 @@ static void * path_run(void *arg) int path_start(struct path *p) { + if (!p) + return -EFAULT; + p->state = RUNNING; pthread_create(&p->tid, NULL, &path_run, (void *) p); } @@ -75,6 +79,9 @@ int path_stop(struct path *p) { void * ret; + if (!p) + return -EFAULT; + p->state = STOPPED; pthread_cancel(p->tid);