File 10848.patch of Package squid-beta

---------------------
PatchSet 10848 
Date: 2007/06/10 12:13:31
Author: hno
Branch: HEAD
Tag: (none) 
Log:
Kill old stale code dealing with deferred reads and delay pools.

Squid-3 already have a deferred read infrastructure dealing with
buffering and delay pools, taking filedescriptors in/out from the
active set when needed. The comm loops don't need to emulate this.

Members: 
	src/comm_poll.cc:1.22->1.23 
	src/comm_select.cc:1.80->1.81 

Index: squid3/src/comm_poll.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/comm_poll.cc,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- squid3/src/comm_poll.cc	10 Jun 2007 11:02:23 -0000	1.22
+++ squid3/src/comm_poll.cc	10 Jun 2007 12:13:31 -0000	1.23
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_poll.cc,v 1.22 2007/06/10 11:02:23 hno Exp $
+ * $Id: comm_poll.cc,v 1.23 2007/06/10 12:13:31 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -179,36 +179,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
-
 static int
 comm_check_incoming_poll_handlers(int nfds, int *fds)
 {
@@ -354,10 +324,6 @@
 {
 
     struct pollfd pfds[SQUID_MAXFD];
-#if DELAY_POOLS
-
-    fd_set slowfds;
-#endif
 
     PF *hdl = NULL;
     int fd;
@@ -373,10 +339,6 @@
         double start;
         getCurrentTime();
         start = current_dtime;
-#if DELAY_POOLS
-
-        FD_ZERO(&slowfds);
-#endif
 
         if (commCheckICPIncoming)
             comm_poll_icp_incoming();
@@ -513,14 +475,6 @@
 
                 if (NULL == (hdl = F->read_handler))
                     (void) 0;
-
-#if DELAY_POOLS
-
-                else if (FD_ISSET(fd, &slowfds))
-                    commAddSlowFd(fd);
-
-#endif
-
                 else {
                     PROF_start(comm_read_handler);
                     F->read_handler = NULL;
@@ -600,30 +554,6 @@
         if (callhttp)
             comm_poll_http_incoming();
 
-#if DELAY_POOLS
-
-        while ((fd = commGetSlowFd()) != -1) {
-            fde *F = &fd_table[fd];
-            debugs(5, 6, "comm_select: slow FD " << fd << " selected for reading");
-
-            if ((hdl = F->read_handler)) {
-                F->read_handler = NULL;
-		F->flags.read_pending = 0;
-                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
         getCurrentTime();
 
         statCounter.select_time += (current_dtime - start);
Index: squid3/src/comm_select.cc
===================================================================
RCS file: /cvsroot/squid/squid3/src/comm_select.cc,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- squid3/src/comm_select.cc	10 Jun 2007 11:02:23 -0000	1.80
+++ squid3/src/comm_select.cc	10 Jun 2007 12:13:31 -0000	1.81
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm_select.cc,v 1.80 2007/06/10 11:02:23 hno Exp $
+ * $Id: comm_select.cc,v 1.81 2007/06/10 12:13:31 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  *
@@ -191,36 +191,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
-
 static int
 comm_check_incoming_select_handlers(int nfds, int *fds)
 {
@@ -362,10 +332,6 @@
     fd_set readfds;
     fd_set pendingfds;
     fd_set writefds;
-#if DELAY_POOLS
-
-    fd_set slowfds;
-#endif
 
     PF *hdl = NULL;
     int fd;
@@ -394,10 +360,6 @@
         double start;
         getCurrentTime();
         start = current_dtime;
-#if DELAY_POOLS
-
-        FD_ZERO(&slowfds);
-#endif
 
         if (commCheckICPIncoming)
             comm_select_icp_incoming();
@@ -558,14 +520,6 @@
 
                 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;
 		    F->flags.read_pending = 0;
@@ -656,31 +610,6 @@
         if (callhttp)
             comm_select_http_incoming();
 
-#if DELAY_POOLS
-
-        while ((fd = commGetSlowFd()) != -1) {
-            F = &fd_table[fd];
-            debugs(5, 6, "comm_select: slow FD " << fd << " selected for reading");
-
-            if ((hdl = F->read_handler)) {
-                F->read_handler = NULL;
-		F->flags.read_pending = 0;
-                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
         getCurrentTime();
 
         statCounter.select_time += (current_dtime - start);