summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-03-18 11:44:28 +0100
committerJan Moskyto Matejka <mq@ucw.cz>2016-03-18 11:47:13 +0100
commit9c92f69272de3795f7289969e815d99a93d0d9b3 (patch)
tree2d4d11008e30140a84ea678475cb3c6c68f5771c
parentfd926ed4eea319b94bd0e09e093b90846bcb169b (diff)
Unix: Substituted select -> poll also in congestion checker
It does strange things when even one fd larger than FD_SETSIZE is passed to select().
-rw-r--r--sysdep/unix/io.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c
index b769de58..eb1c1cad 100644
--- a/sysdep/unix/io.c
+++ b/sysdep/unix/io.c
@@ -1679,19 +1679,12 @@ sk_maybe_write(sock *s)
int
sk_rx_ready(sock *s)
{
- fd_set rd, wr;
- struct timeval timo;
int rv;
-
- FD_ZERO(&rd);
- FD_ZERO(&wr);
- FD_SET(s->fd, &rd);
-
- timo.tv_sec = 0;
- timo.tv_usec = 0;
+ struct pollfd pfd = { .fd = s->fd };
+ pfd.events |= POLLIN;
redo:
- rv = select(s->fd+1, &rd, &wr, NULL, &timo);
+ rv = poll(&pfd, 1, 0);
if ((rv < 0) && (errno == EINTR || errno == EAGAIN))
goto redo;