0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-09 18:41:55 +00:00

Unix: Substituted select -> poll also in congestion checker

It does strange things when even one fd larger than FD_SETSIZE is
passed to select().
This commit is contained in:
Jan Moskyto Matejka 2016-03-18 11:44:28 +01:00 committed by Pavel Tvrdik
parent 160457b853
commit 7b02a9039e

View File

@ -1674,19 +1674,12 @@ sk_maybe_write(sock *s)
int int
sk_rx_ready(sock *s) sk_rx_ready(sock *s)
{ {
fd_set rd, wr;
struct timeval timo;
int rv; int rv;
struct pollfd pfd = { .fd = s->fd };
FD_ZERO(&rd); pfd.events |= POLLIN;
FD_ZERO(&wr);
FD_SET(s->fd, &rd);
timo.tv_sec = 0;
timo.tv_usec = 0;
redo: redo:
rv = select(s->fd+1, &rd, &wr, NULL, &timo); rv = poll(&pfd, 1, 0);
if ((rv < 0) && (errno == EINTR || errno == EAGAIN)) if ((rv < 0) && (errno == EINTR || errno == EAGAIN))
goto redo; goto redo;