libfetch: Use select(2) as a consequence of switching to non-blocking
authorJohn Marino <draco@marino.st>
Fri, 2 Nov 2012 18:46:13 +0000 (19:46 +0100)
committerJohn Marino <draco@marino.st>
Fri, 2 Nov 2012 19:08:09 +0000 (20:08 +0100)
commitf3e2e424df47953bf38d1ac9bb133d7a037b3112
treefcae5265caa99133b54ff08f9a97938955157903
parent1a343b52c8323fbdb6cc6c89e9b74e6fe2e8a95a
libfetch: Use select(2) as a consequence of switching to non-blocking

Since the socket is non-blocking, it is necessary to use select(2) even
when there is no timeout, because read(2) will return immediately if there
is no data waiting in the TCP buffer, causing fetch_read() to busy-loop on
slow connections.

Taken-from: FreeBSD SVN 234837 (30 APR 2012)
lib/libfetch/common.c