
In a networking loop, we used to asume that 3 was the minimum fd (without any
comments about it), and then check if the fd was lfd.

Instead, we can both make the code readable and faster by using lfd as the
minimum file descriptor, and skip the test.


 net.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -puN net.c~lfd_is_minfd net.c
--- cur/net.c~lfd_is_minfd	2004-01-17 21:09:32.000000000 -0300
+++ cur-root/net.c	2004-01-17 21:09:32.000000000 -0300
@@ -164,9 +164,9 @@ void net_select_loop(int nthreads) {
 		}
 		
 		workdone = 0;
-		for (i = 3; i <= maxfd; i++) {
-			/* skip the ones not in the set or busy and lfd */
-			if (!FD_ISSET(i, &readfds) || fd_busy[i] || i == lfd)
+		for (i = lfd + 1; i <= maxfd; i++) {
+			/* skip the ones not in the set or busy */
+			if (!FD_ISSET(i, &readfds) || fd_busy[i])
 				continue;
 			
 			/* loop looking for an idle thread; see

_
