1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

path: fix detection of polling mode

This commit is contained in:
Steffen Vogel 2019-01-30 01:57:20 +01:00
parent bf12c174f2
commit 5fc38bb898

View file

@ -641,12 +641,18 @@ int path_parse(struct path *p, json_t *cfg, struct vlist *nodes)
/* Autodetect whether to use poll() for this path or not */
if (p->poll == -1) {
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, 0);
if (p->rate > 0)
p->poll = 1;
else if (vlist_length(&p->sources) > 1)
p->poll = 1;
else {
struct path_source *ps = (struct path_source *) vlist_at(&p->sources, 0);
int fds[16];
int num_fds = node_poll_fds(ps->node, fds);
int fds[16];
int num_fds = node_poll_fds(ps->node, fds);
p->poll = (p->rate > 0 || vlist_length(&p->sources) > 1) && num_fds > 0;
p->poll = num_fds > 0;
}
}
ret = vlist_destroy(&sources, NULL, false);