mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
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
This commit is contained in:
parent
0dbe107bbb
commit
cc144cdc8a
1 changed files with 10 additions and 3 deletions
13
src/path.c
13
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue