--------------------- PatchSet 7153 Date: 2005/11/02 02:25:33 Author: adri Branch: tidyup_deferred_reads Tag: (none) Log: * Remove the deferred read checking code for both poll and select. * Remove the 'slow fds' stuff - it'll be replaced by something when my replacement delay pools code goes in. Members: src/comm_select.c:1.8.6.6.24.3->1.8.6.6.24.4 Index: squid/src/comm_select.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/comm_select.c,v retrieving revision 1.8.6.6.24.3 retrieving revision 1.8.6.6.24.4 diff -u -r1.8.6.6.24.3 -r1.8.6.6.24.4 --- squid/src/comm_select.c 2 Nov 2005 02:12:22 -0000 1.8.6.6.24.3 +++ squid/src/comm_select.c 2 Nov 2005 02:25:33 -0000 1.8.6.6.24.4 @@ -1,6 +1,6 @@ /* - * $Id: comm_select.c,v 1.8.6.6.24.3 2005/11/02 02:12:22 adri Exp $ + * $Id: comm_select.c,v 1.8.6.6.24.4 2005/11/02 02:25:33 adri Exp $ * * DEBUG: section 5 Socket Functions * @@ -52,7 +52,6 @@ static int fdIsHttp(int fd); static int fdIsIcp(int fd); static int fdIsDns(int fd); -static int commDeferRead(int fd); static void checkTimeouts(void); static OBJH commIncomingStats; #if HAVE_POLL @@ -133,15 +132,6 @@ #define commCheckHTTPIncoming (++http_io_events > (incoming_http_interval>> INCOMING_FACTOR)) static int -commDeferRead(int fd) -{ - fde *F = &fd_table[fd]; - if (F->defer_check == NULL) - return 0; - return F->defer_check(fd, F->defer_data); -} - -static int fdIsIcp(int fd) { if (fd == theInIcpConnection) @@ -170,31 +160,6 @@ return 0; } -#if DELAY_POOLS -static int slowfdcnt = 0; -static int slowfdarr[SQUID_MAXFD]; - -static void -commAddSlowFd(int fd) -{ - assert(slowfdcnt < SQUID_MAXFD); - slowfdarr[slowfdcnt++] = fd; -} - -static int -commGetSlowFd(void) -{ - int whichfd, retfd; - - if (!slowfdcnt) - return -1; - whichfd = squid_random() % slowfdcnt; - retfd = slowfdarr[whichfd]; - slowfdarr[whichfd] = slowfdarr[--slowfdcnt]; - return retfd; -} -#endif - #if HAVE_POLL static int comm_check_incoming_poll_handlers(int nfds, int *fds) @@ -307,9 +272,6 @@ comm_poll(int msec) { struct pollfd pfds[SQUID_MAXFD]; -#if DELAY_POOLS - fd_set slowfds; -#endif PF *hdl = NULL; int fd; unsigned int i; @@ -329,9 +291,6 @@ #endif /* Handle any fs callbacks that need doing */ storeDirCallback(); -#if DELAY_POOLS - FD_ZERO(&slowfds); -#endif if (commCheckICPIncoming) comm_poll_icp_incoming(); if (commCheckDNSIncoming) @@ -347,21 +306,7 @@ events = 0; /* Check each open socket for a handler. */ if (fd_table[i].read_handler) { - switch (commDeferRead(i)) { - case 0: - events |= POLLRDNORM; - break; - case 1: - break; -#if DELAY_POOLS - case -1: events |= POLLRDNORM; - FD_SET(i, &slowfds); - break; -#endif - default: - fatalf("bad return value from commDeferRead(FD %d)\n", i); - } } if (fd_table[i].write_handler) events |= POLLWRNORM; @@ -434,10 +379,6 @@ debug(5, 6) ("comm_poll: FD %d ready for reading\n", fd); if (NULL == (hdl = F->read_handler)) (void) 0; -#if DELAY_POOLS - else if (FD_ISSET(fd, &slowfds)) - commAddSlowFd(fd); -#endif else { F->read_handler = NULL; hdl(fd, F->read_data); @@ -495,23 +436,6 @@ comm_poll_dns_incoming(); if (callhttp) comm_poll_http_incoming(); -#if DELAY_POOLS - while ((fd = commGetSlowFd()) != -1) { - fde *F = &fd_table[fd]; - debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd); - if ((hdl = F->read_handler)) { - F->read_handler = NULL; - hdl(fd, F->read_data); - statCounter.select_fds++; - if (commCheckICPIncoming) - comm_poll_icp_incoming(); - if (commCheckDNSIncoming) - comm_poll_dns_incoming(); - if (commCheckHTTPIncoming) - comm_poll_http_incoming(); - } - } -#endif #if !ALARM_UPDATES_TIME getCurrentTime(); statCounter.select_time += (current_dtime - start); @@ -641,9 +565,6 @@ fd_set readfds; fd_set pendingfds; fd_set writefds; -#if DELAY_POOLS - fd_set slowfds; -#endif PF *hdl = NULL; int fd; int maxfd; @@ -700,20 +621,6 @@ continue; /* Found a set bit */ fd = (j * FD_MASK_BITS) + k; - switch (commDeferRead(fd)) { - case 0: - break; - case 1: - FD_CLR(fd, &readfds); - break; -#if DELAY_POOLS - case -1: - FD_SET(fd, &slowfds); - break; -#endif - default: - fatalf("bad return value from commDeferRead(FD %d)\n", fd); - } if (FD_ISSET(fd, &readfds) && fd_table[fd].flags.read_pending) { FD_SET(fd, &pendingfds); pending++; @@ -723,11 +630,7 @@ #if DEBUG_FDBITS for (i = 0; i < maxfd; i++) { /* Check each open socket for a handler. */ -#if DELAY_POOLS - if (fd_table[i].read_handler && commDeferRead(i) != 1) { -#else - if (fd_table[i].read_handler && !commDeferRead(i)) { -#endif + if (fd_table[i].read_handler) { assert(FD_ISSET(i, &readfds)); } if (fd_table[i].write_handler) { @@ -807,10 +710,6 @@ debug(5, 6) ("comm_select: FD %d ready for reading\n", fd); if (NULL == (hdl = F->read_handler)) (void) 0; -#if DELAY_POOLS - else if (FD_ISSET(fd, &slowfds)) - commAddSlowFd(fd); -#endif else { F->read_handler = NULL; commUpdateReadBits(fd, NULL); @@ -875,24 +774,6 @@ comm_select_dns_incoming(); if (callhttp) comm_select_http_incoming(); -#if DELAY_POOLS - while ((fd = commGetSlowFd()) != -1) { - F = &fd_table[fd]; - debug(5, 6) ("comm_select: slow FD %d selected for reading\n", fd); - if ((hdl = F->read_handler)) { - F->read_handler = NULL; - commUpdateReadBits(fd, NULL); - hdl(fd, F->read_data); - statCounter.select_fds++; - if (commCheckICPIncoming) - comm_select_icp_incoming(); - if (commCheckDNSIncoming) - comm_select_dns_incoming(); - if (commCheckHTTPIncoming) - comm_select_http_incoming(); - } - } -#endif #if !ALARM_UPDATES_TIME getCurrentTime(); statCounter.select_time += (current_dtime - start);