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:
parent
bf12c174f2
commit
5fc38bb898
1 changed files with 10 additions and 4 deletions
14
lib/path.c
14
lib/path.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue