mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
simplified path concept to single outgoing node (for now)
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@10 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
a27d709f07
commit
0dbe107bbb
2 changed files with 9 additions and 10 deletions
|
@ -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()
|
||||
|
|
13
src/path.c
13
src/path.c
|
@ -8,21 +8,21 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
|
||||
#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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue