diff options
-rw-r--r-- | ingest.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ingest.c b/ingest.c index 3fb5e40..1dfae36 100644 --- a/ingest.c +++ b/ingest.c @@ -56,7 +56,14 @@ int main(void) { { .events = POLLIN, .fd = STDIN_FILENO }, { .events = POLLIN, .fd = server }, }; - while (0 < poll(fds, 2, -1)) { + for (;;) { + int nfds = poll(fds, 2, 60 * 1000); + if (nfds < 0) err(EX_IOERR, "poll"); + + if (!nfds) { + // TODO: Increment idle time in info. + } + if (fds[0].revents) { char buf[4096]; ssize_t rlen = read(STDIN_FILENO, buf, sizeof(buf)); @@ -106,5 +113,4 @@ int main(void) { assert(client == maxClient); } } - err(EX_IOERR, "poll"); } |