]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Unix: Substituted select -> poll also in congestion checker
authorJan Moskyto Matejka <mq@ucw.cz>
Fri, 18 Mar 2016 10:44:28 +0000 (11:44 +0100)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Tue, 3 May 2016 07:25:37 +0000 (09:25 +0200)
It does strange things when even one fd larger than FD_SETSIZE is
passed to select().

sysdep/unix/io.c

index 1fba54e3a8db6b8aa8a9ca55e54061f625fd009c..eae8885fa7a86348c481f477caae575d7aaa4514 100644 (file)
@@ -1674,19 +1674,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;