--------------------- PatchSet 5910 Date: 2003/08/30 15:27:21 Author: serassio Branch: nt-2_5 Tag: (none) Log: Fixed a wrong count during defer check of read FDs in comm_select() Members: src/comm_select.c:1.8.10.13->1.8.10.14 Index: squid/src/comm_select.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm_select.c,v retrieving revision 1.8.10.13 retrieving revision 1.8.10.14 diff -u -r1.8.10.13 -r1.8.10.14 --- squid/src/comm_select.c 17 Aug 2003 12:12:54 -0000 1.8.10.13 +++ squid/src/comm_select.c 30 Aug 2003 15:27:21 -0000 1.8.10.14 @@ -1,6 +1,6 @@ /* - * $Id: comm_select.c,v 1.8.10.13 2003/08/17 12:12:54 serassio Exp $ + * $Id: comm_select.c,v 1.8.10.14 2003/08/30 15:27:21 serassio Exp $ * * DEBUG: section 5 Socket Functions * @@ -728,6 +728,9 @@ break; case 1: FD_CLR(fd, &readfds); + /* FD_CLR() decrements readfds.fd_count, so we must */ + /* decrement too the counter j */ + j--; break; #if DELAY_POOLS case -1: @@ -809,7 +812,7 @@ poll_time.tv_usec = (msec % 1000) * 1000; statCounter.syscalls.selects++; #ifdef _SQUID_MSWIN_ - num = select(maxfd, &readfds, &writefds, &errfds, &poll_time); + num = select(maxfd, &readfds, &writefds, &errfds, &poll_time); #else num = select(maxfd, &readfds, &writefds, NULL, &poll_time); #endif @@ -841,7 +844,7 @@ #ifdef _SQUID_MSWIN_ assert(readfds.fd_count <= (unsigned int) Biggest_FD); assert(pendingfds.fd_count <= (unsigned int) Biggest_FD); - for (j = 0; j < (int) readfds.fd_count; j++) { + for (j = 0; j < (int) __max(readfds.fd_count, pendingfds.fd_count); j++) { register int readfds_handle = readfds.fd_array[j]; register int pendingfds_handle = pendingfds.fd_array[j]; register int osfhandle; @@ -855,8 +858,8 @@ break; } } - } - if (no_bits) + } + if (no_bits) continue; #else fdsp = (fd_mask *) & readfds;