From cac23d61dcf94ea1e566d3556341c94ea8ff8be4 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Tue, 15 Dec 2015 12:28:23 +0100 Subject: [PATCH] use a copy of the slowaccept flag, as it may change within the poll() loop --- sndiod/listen.c | 7 ++++++- sndiod/listen.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sndiod/listen.c b/sndiod/listen.c index 5f0ee1c..ee06643 100644 --- a/sndiod/listen.c +++ b/sndiod/listen.c @@ -217,7 +217,8 @@ listen_pollfd(void *arg, struct pollfd *pfd) { struct listen *f = arg; - if (file_slowaccept) + f->slowaccept = file_slowaccept; + if (f->slowaccept) return 0; pfd->fd = f->fd; pfd->events = POLLIN; @@ -227,6 +228,10 @@ listen_pollfd(void *arg, struct pollfd *pfd) int listen_revents(void *arg, struct pollfd *pfd) { + struct listen *f = arg; + + if (f->slowaccept) + return 0; return pfd->revents; } diff --git a/sndiod/listen.h b/sndiod/listen.h index c64aeca..d53e9f3 100644 --- a/sndiod/listen.h +++ b/sndiod/listen.h @@ -24,6 +24,7 @@ struct listen { struct file *file; char *path; int fd; + int slowaccept; }; extern struct listen *listen_list;