diff -urN squid-2.3.DEVEL2/makefile.in squid-2.3.DEVEL2.DJL0/makefile.in --- squid-2.3.DEVEL2/makefile.in Wed May 5 05:06:01 1999 +++ squid-2.3.DEVEL2.DJL0/makefile.in Mon Oct 18 22:02:07 1999 @@ -16,7 +16,8 @@ SUBDIRS = lib @makesnmplib@ scripts src icons errors AUTHDIRS = auth_modules/NCSA auth_modules/getpwnam \ - auth_modules/PAM + auth_modules/PAM auth_modules/SMB \ + auth_modules/LDAP noargs: all diff -urN squid-2.3.DEVEL2/src/Makefile.in squid-2.3.DEVEL2.DJL0/src/Makefile.in --- squid-2.3.DEVEL2/src/Makefile.in Thu Jul 8 03:11:12 1999 +++ squid-2.3.DEVEL2.DJL0/src/Makefile.in Mon Oct 18 21:31:48 1999 @@ -365,7 +365,7 @@ -rm -f cf_gen cf_parser.c cf.data globals.c string_arrays.c distclean: clean - -rm -f Makefile squid.conf squid.conf.pre + -rm -f Makefile Makefile.bak squid.conf squid.conf.pre tags: ctags *.[ch] ../include/*.h ../lib/*.[ch] diff -urN squid-2.3.DEVEL2/src/comm_select.c squid-2.3.DEVEL2.DJL0/src/comm_select.c --- squid-2.3.DEVEL2/src/comm_select.c Thu Jul 8 05:09:29 1999 +++ squid-2.3.DEVEL2.DJL0/src/comm_select.c Mon Oct 18 21:58:16 1999 @@ -172,6 +172,31 @@ 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) @@ -286,6 +311,9 @@ comm_poll(int msec) { struct pollfd pfds[SQUID_MAXFD]; +#if DELAY_POOLS + fd_set slowfds; +#endif PF *hdl = NULL; int fd; int i; @@ -318,8 +346,26 @@ int events; events = 0; /* Check each open socket for a handler. */ +#if DELAY_POOLS + if (fd_table[i].read_handler) { + switch (commDeferRead(i)) { + case 0: + events |= POLLRDNORM; + break; + case 1: + break; + case -1: + events |= POLLRDNORM; + FD_SET(i, &slowfds); + break; + default: + assert(!"commDeferRead(i) should return 0,1,-1"); + } + } +#else if (fd_table[i].read_handler && !commDeferRead(i)) events |= POLLRDNORM; +#endif if (fd_table[i].write_handler) events |= POLLWRNORM; if (events) { @@ -381,6 +427,12 @@ if (revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR)) { debug(5, 6) ("comm_poll: FD %d ready for reading\n", fd); if ((hdl = F->read_handler)) { +#if DELAY_POOLS + if (FD_ISSET(fd, &slowfds)) { + commAddSlowFd(fd); + goto skip_r; + } +#endif F->read_handler = NULL; hdl(fd, F->read_data); Counter.select_fds++; @@ -392,6 +444,9 @@ if (commCheckHTTPIncoming) comm_poll_http_incoming(); } +#if DELAY_POOLS + skip_r: +#endif if (revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR)) { debug(5, 5) ("comm_poll: FD %d ready for writing\n", fd); if ((hdl = F->write_handler)) { @@ -437,6 +492,22 @@ 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); + hdl = F->read_handler; + F->read_handler = NULL; + hdl(fd, F->read_data); + Counter.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(); Counter.select_time += (current_dtime - start); @@ -567,6 +638,9 @@ { fd_set readfds; fd_set writefds; +#if DELAY_POOLS + fd_set slowfds; +#endif PF *hdl = NULL; int fd; int maxfd; @@ -604,6 +678,9 @@ howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES); xmemcpy(&writefds, &global_writefds, howmany(maxfd, FD_MASK_BITS) * FD_MASK_BYTES); +#if DELAY_POOLS + FD_ZERO(&slowfds); +#endif /* remove stalled FDs */ maxindex = howmany(maxfd, FD_MASK_BITS); fdsp = (fd_mask *) & readfds; @@ -615,14 +692,33 @@ continue; /* Found a set bit */ fd = (j * FD_MASK_BITS) + k; +#if DELAY_POOLS + switch (commDeferRead(fd)) { + case 0: + break; + case 1: + FD_CLR(fd, &readfds); + break; + case -1: + FD_SET(fd, &slowfds); + break; + default: + assert(!"commDeferRead(fd) should return 0,1,-1"); + } +#else if (commDeferRead(fd)) FD_CLR(fd, &readfds); +#endif } } #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 assert(FD_ISSET(i, &readfds)); } if (fd_table[i].write_handler) { @@ -686,16 +782,22 @@ #endif if (fdIsIcp(fd)) { callicp = 1; - continue; + goto out_r; } if (fdIsDns(fd)) { calldns = 1; - continue; + goto out_r; } if (fdIsHttp(fd)) { callhttp = 1; - continue; + goto out_r; + } +#if DELAY_POOLS + if (FD_ISSET(fd, &slowfds)) { + commAddSlowFd(fd); + goto out_r; } +#endif F = &fd_table[fd]; debug(5, 6) ("comm_select: FD %d ready for reading\n", fd); if (F->read_handler) { @@ -711,6 +813,7 @@ comm_select_dns_incoming(); if (commCheckHTTPIncoming) comm_select_http_incoming(); + out_r: EBIT_CLR(tmask, k); /* this bit is done */ if (tmask == 0) break; /* and no more bits left */ @@ -731,15 +834,15 @@ #endif if (fdIsIcp(fd)) { callicp = 1; - continue; + goto out_w; } if (fdIsDns(fd)) { calldns = 1; - continue; + goto out_w; } if (fdIsHttp(fd)) { callhttp = 1; - continue; + goto out_w; } F = &fd_table[fd]; debug(5, 5) ("comm_select: FD %d ready for writing\n", fd); @@ -756,6 +859,7 @@ comm_select_dns_incoming(); if (commCheckHTTPIncoming) comm_select_http_incoming(); + out_w: EBIT_CLR(tmask, k); /* this bit is done */ if (tmask == 0) break; /* and no more bits left */ @@ -767,6 +871,25 @@ 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 (F->read_handler) { + hdl = F->read_handler; + F->read_handler = NULL; + commUpdateReadBits(fd, NULL); + hdl(fd, F->read_data); + Counter.select_fds++; + } + if (commCheckICPIncoming) + comm_select_icp_incoming(); + if (commCheckDNSIncoming) + comm_select_dns_incoming(); + if (commCheckHTTPIncoming) + comm_select_http_incoming(); + } +#endif return COMM_OK; } while (timeout > current_dtime); diff -urN squid-2.3.DEVEL2/src/dns.c squid-2.3.DEVEL2.DJL0/src/dns.c --- squid-2.3.DEVEL2/src/dns.c Fri Jun 18 06:20:37 1999 +++ squid-2.3.DEVEL2.DJL0/src/dns.c Mon Oct 18 21:31:48 1999 @@ -72,8 +72,8 @@ cachemgrRegister("dns", "Dnsserver Statistics", dnsStats, 0, 1); + init++; } - init++; #endif } diff -urN squid-2.3.DEVEL2/src/forward.c squid-2.3.DEVEL2.DJL0/src/forward.c --- squid-2.3.DEVEL2/src/forward.c Sat Jul 31 07:46:07 1999 +++ squid-2.3.DEVEL2.DJL0/src/forward.c Mon Oct 18 21:31:48 1999 @@ -477,6 +477,12 @@ { StoreEntry *e = data; MemObject *mem = e->mem_obj; +#ifdef DELAY_POOLS + int i = 0; +#else +#define i 0 +#endif + if (mem == NULL) return 0; #if DELAY_POOLS @@ -484,14 +490,21 @@ (void) 0; else if (delayIsNoDelay(fd)) (void) 0; - else if (delayMostBytesWanted(mem, 1) == 0) - return 1; + else { + i = delayMostBytesWanted(mem, INT_MAX); + if (i == 0) + return 1; + i = -(i != INT_MAX); + } #endif if (EBIT_TEST(e->flags, ENTRY_FWD_HDR_WAIT)) - return 0; + return i; if (mem->inmem_hi - storeLowestMemReaderOffset(e) < READ_AHEAD_GAP) - return 0; + return i; return 1; +#ifndef DELAY_POOLS +#undef i +#endif } void diff -urN squid-2.3.DEVEL2/src/redirect.c squid-2.3.DEVEL2.DJL0/src/redirect.c --- squid-2.3.DEVEL2/src/redirect.c Fri Jun 25 06:08:43 1999 +++ squid-2.3.DEVEL2.DJL0/src/redirect.c Mon Oct 18 21:31:48 1999 @@ -151,8 +151,8 @@ cachemgrRegister("redirector", "URL Redirector Stats", redirectStats, 0, 1); + init++; } - init++; } void diff -urN squid-2.3.DEVEL2/src/squid.h squid-2.3.DEVEL2.DJL0/src/squid.h --- squid-2.3.DEVEL2/src/squid.h Fri Jun 25 04:20:07 1999 +++ squid-2.3.DEVEL2.DJL0/src/squid.h Mon Oct 18 21:31:48 1999 @@ -175,6 +175,9 @@ #if HAVE_GETOPT_H #include #endif +#if HAVE_LIMITS_H +#include +#endif #if HAVE_DIRENT_H #include diff -urN squid-2.3.DEVEL2/src/ssl.c squid-2.3.DEVEL2.DJL0/src/ssl.c --- squid-2.3.DEVEL2/src/ssl.c Sat Jul 31 07:46:10 1999 +++ squid-2.3.DEVEL2.DJL0/src/ssl.c Mon Oct 18 21:31:48 1999 @@ -119,7 +119,14 @@ sslDeferServerRead(int fdnotused, void *data) { SslStateData *s = data; - return delayBytesWanted(s->delay_id, 0, 1) == 0; + int i; + + i = delayBytesWanted(s->delay_id, 0, INT_MAX); + if(i == INT_MAX) + return 0; + if(i == 0) + return 1; + return -1; } #endif