ipselect: set a timeout of 1 second - teed - A multiplex relay tee(1) daemon. Err bitreich.org 70
hgit clone git://bitreich.org/teed git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/teed URL:git://bitreich.org/teed git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/teed bitreich.org 70
1Log /scm/teed/log.gph bitreich.org 70
1Files /scm/teed/files.gph bitreich.org 70
1Refs /scm/teed/refs.gph bitreich.org 70
1Tags /scm/teed/tag bitreich.org 70
1README /scm/teed/file/README.md.gph bitreich.org 70
1LICENSE /scm/teed/file/LICENSE.gph bitreich.org 70
i--- Err bitreich.org 70
1commit 8d1db0f43e921b998a06dd61d1442220db29ee89 /scm/teed/commit/8d1db0f43e921b998a06dd61d1442220db29ee89.gph bitreich.org 70
1parent 18db7808b4a41155537b83db1294720403990b4c /scm/teed/commit/18db7808b4a41155537b83db1294720403990b4c.gph bitreich.org 70
hAuthor: Hiltjo Posthuma <hiltjo@codemadness.org> URL:mailto:hiltjo@codemadness.org bitreich.org 70
iDate: Mon, 14 Aug 2023 14:22:16 +0200 Err bitreich.org 70
i Err bitreich.org 70
ipselect: set a timeout of 1 second Err bitreich.org 70
i Err bitreich.org 70
iThis is for sockets that are closed. These are signalled by FD_ISSET and a Err bitreich.org 70
iread() that returns 0. This way it can handle them directly when it occurs vs Err bitreich.org 70
ion the next read of a socket. Err bitreich.org 70
i Err bitreich.org 70
iSigned-off-by: Christoph Lohmann <20h@r-36.net> Err bitreich.org 70
i Err bitreich.org 70
iDiffstat: Err bitreich.org 70
i M teed.c | 5 ++++- Err bitreich.org 70
i Err bitreich.org 70
i1 file changed, 4 insertions(+), 1 deletion(-) Err bitreich.org 70
i--- Err bitreich.org 70
1diff --git a/teed.c b/teed.c /scm/teed/file/teed.c.gph bitreich.org 70
i@@ -161,6 +161,7 @@ main(int argc, char *argv[]) Err bitreich.org 70
i llist *wfds, *rfds, *lfds, *e, *qe; Err bitreich.org 70
i socklen_t saddrlen, cltlen; Err bitreich.org 70
i fd_set fdset; Err bitreich.org 70
i+ struct timespec timeout; Err bitreich.org 70
i Err bitreich.org 70
i initsignals(); Err bitreich.org 70
i Err bitreich.org 70
i@@ -210,6 +211,8 @@ main(int argc, char *argv[]) Err bitreich.org 70
i lfds = llist_put(lfds, &lfd, sizeof(lfd)); Err bitreich.org 70
i } Err bitreich.org 70
i Err bitreich.org 70
i+ timeout.tv_sec = 1; Err bitreich.org 70
i+ timeout.tv_nsec = 0; Err bitreich.org 70
i for (;;) { Err bitreich.org 70
i maxsfd = 0; Err bitreich.org 70
i FD_ZERO(&fdset); Err bitreich.org 70
i@@ -224,7 +227,7 @@ main(int argc, char *argv[]) Err bitreich.org 70
i maxsfd = *(int *)e->data; Err bitreich.org 70
i } Err bitreich.org 70
i Err bitreich.org 70
i- if (pselect(maxsfd+1, &fdset, NULL, NULL, NULL, NULL) < 0) { Err bitreich.org 70
i+ if (pselect(maxsfd+1, &fdset, NULL, NULL, &timeout, NULL) < 0) { Err bitreich.org 70
i if (errno == EINTR) Err bitreich.org 70
i continue; Err bitreich.org 70
i perror("pselect"); Err bitreich.org 70
.
Response:
text/plain