diff --context --recursive squid-1.1.1.ucs.cns/src/acl.c squid-1.1.1.ucs.cns.2/src/acl.c *** squid-1.1.1.ucs.cns/src/acl.c Mon Dec 16 19:20:53 1996 --- squid-1.1.1.ucs.cns.2/src/acl.c Tue Dec 17 12:47:04 1996 *************** *** 44,49 **** --- 44,50 ---- struct _acl_access *MISSAccessList = NULL; #ifdef DELAY_HACK struct _acl_access *DelayAccessList = NULL; + struct _acl_access *DelayChildAccessList = NULL; #endif static struct _acl *AclList = NULL; diff --context --recursive squid-1.1.1.ucs.cns/src/acl.h squid-1.1.1.ucs.cns.2/src/acl.h *** squid-1.1.1.ucs.cns/src/acl.h Mon Dec 16 19:20:53 1996 --- squid-1.1.1.ucs.cns.2/src/acl.h Tue Dec 17 12:00:39 1996 *************** *** 149,152 **** --- 149,153 ---- #ifdef DELAY_HACK extern struct _acl_access *DelayAccessList; + extern struct _acl_access *DelayChildAccessList; #endif diff --context --recursive squid-1.1.1.ucs.cns/src/cache_cf.c squid-1.1.1.ucs.cns.2/src/cache_cf.c *** squid-1.1.1.ucs.cns/src/cache_cf.c Mon Dec 16 19:20:53 1996 --- squid-1.1.1.ucs.cns.2/src/cache_cf.c Tue Dec 17 12:44:37 1996 *************** *** 117,126 **** #define DefaultNetdbLow 900 #ifdef DELAY_HACK ! #define DefaultDelayMaxBytes 100000 ! #define DefaultDelayRestoreBytes 10000 ! #define DefaultDelayHostMaxBytes 20000 ! #define DefaultDelayHostRestoreBytes 2000 #endif #define DefaultWaisRelayHost (char *)NULL --- 117,128 ---- #define DefaultNetdbLow 900 #ifdef DELAY_HACK ! #define DefaultDelayMaxBytes 102400 ! #define DefaultDelayRestoreBytes 3584 ! #define DefaultDelayHostMaxBytes 10240 ! #define DefaultDelayHostRestoreBytes 384 ! #define DefaultDelayChildMaxBytes 204800 ! #define DefaultDelayChildRestoreBytes 8192 #endif #define DefaultWaisRelayHost (char *)NULL *************** *** 238,245 **** --- 240,249 ---- #ifdef DELAY_HACK static void parseDelayRestoreLine _PARAMS((void)); static void parseDelayHostRestoreLine _PARAMS((void)); + static void parseDelayChildRestoreLine _PARAMS((void)); static void parseDelayMaxLine _PARAMS((void)); static void parseDelayHostMaxLine _PARAMS((void)); + static void parseDelayChildMaxLine _PARAMS((void)); #endif static void parseEffectiveUserLine _PARAMS((void)); static void parseErrHtmlLine _PARAMS((void)); *************** *** 915,920 **** --- 919,933 ---- } static void + parseDelayChildRestoreLine() + { + char *token; + int i; + GetInteger(i); + Config.delay_child_restore = i; /* ditto, per-host pool */ + } + + static void parseDelayMaxLine() { char *token; *************** *** 931,936 **** --- 944,958 ---- GetInteger(i); Config.delay_host_max = i; /* ditto, per-host pool */ } + + static void + parseDelayChildMaxLine() + { + char *token; + int i; + GetInteger(i); + Config.delay_child_max = i; /* ditto, per-host pool */ + } #endif static void *************** *** 1098,1103 **** --- 1120,1126 ---- aclDestroyAccessList(&ICPAccessList); #ifdef DELAY_HACK aclDestroyAccessList(&DelayAccessList); + aclDestroyAccessList(&DelayChildAccessList); #endif aclDestroyRegexList(Config.cache_stop_relist); Config.cache_stop_relist = NULL; *************** *** 1225,1230 **** --- 1248,1256 ---- else if (!strcmp(token, "delay_access")) aclParseAccessLine(&DelayAccessList); + else if (!strcmp(token, "delay_child_access")) + aclParseAccessLine(&DelayChildAccessList); + else if (!strcmp(token, "delay_max")) parseDelayMaxLine(); *************** *** 1236,1241 **** --- 1262,1273 ---- else if (!strcmp(token, "delay_host_restore")) parseDelayHostRestoreLine(); + + else if (!strcmp(token, "delay_child_max")) + parseDelayChildMaxLine(); + + else if (!strcmp(token, "delay_child_restore")) + parseDelayChildRestoreLine(); #endif else if (!strcmp(token, "refresh_pattern")) *************** *** 1620,1625 **** --- 1652,1659 ---- Config.delay_restore = DefaultDelayRestoreBytes; Config.delay_host_max = DefaultDelayHostMaxBytes; Config.delay_host_restore = DefaultDelayHostRestoreBytes; + Config.delay_child_max = DefaultDelayChildMaxBytes; + Config.delay_child_restore = DefaultDelayChildRestoreBytes; #endif Config.Announce.host = safe_xstrdup(DefaultAnnounceHost); Config.Announce.port = DefaultAnnouncePort; diff --context --recursive squid-1.1.1.ucs.cns/src/cache_cf.h squid-1.1.1.ucs.cns.2/src/cache_cf.h *** squid-1.1.1.ucs.cns/src/cache_cf.h Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/cache_cf.h Tue Dec 17 11:59:03 1996 *************** *** 207,212 **** --- 207,214 ---- int delay_max; int delay_host_restore; int delay_host_max; + int delay_child_restore; + int delay_child_max; #endif struct { char *host; diff --context --recursive squid-1.1.1.ucs.cns/src/comm.c squid-1.1.1.ucs.cns.2/src/comm.c *** squid-1.1.1.ucs.cns/src/comm.c Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/comm.c Tue Dec 17 12:04:43 1996 *************** *** 937,949 **** if (squid_curtime > delay_data.last_update) { time_diff = squid_curtime - delay_data.last_update; delay_data.last_update = squid_curtime; ! delay_data.bytes = delay_data.bytes + (restbyte = (Config.delay_restore * time_diff)); debug(5, 2, "comm_select: DELAY %d bytes incremented, now = %d\n", restbyte, delay_data.bytes); maxbyte = Config.delay_max; if (delay_data.bytes > maxbyte) { delay_data.bytes = maxbyte; debug(5, 5, "comm_select: DELAY bytes set to max %d\n", maxbyte); } maxbyte = Config.delay_host_max; restbyte = Config.delay_host_restore; for(net=0;;net++) { --- 937,956 ---- if (squid_curtime > delay_data.last_update) { time_diff = squid_curtime - delay_data.last_update; delay_data.last_update = squid_curtime; ! delay_data.bytes += (restbyte = (Config.delay_restore * time_diff)); debug(5, 2, "comm_select: DELAY %d bytes incremented, now = %d\n", restbyte, delay_data.bytes); maxbyte = Config.delay_max; if (delay_data.bytes > maxbyte) { delay_data.bytes = maxbyte; debug(5, 5, "comm_select: DELAY bytes set to max %d\n", maxbyte); } + delay_data.child_bytes += (restbyte = (Config.delay_child_restore * time_diff)); + debug(5, 2, "comm_select: DELAY CHILD %d bytes incremented, now = %d\n", restbyte, delay_data.child_bytes); + maxbyte = Config.delay_child_max; + if (delay_data.child_bytes > maxbyte) { + delay_data.child_bytes = maxbyte; + debug(5, 5, "comm_select: DELAY CHILD bytes set to max %d\n", maxbyte); + } maxbyte = Config.delay_host_max; restbyte = Config.delay_host_restore; for(net=0;;net++) { *************** *** 1293,1298 **** --- 1300,1306 ---- /* this bit sets up the structure that holds the delay_data info. */ delay_data.bytes = Config.delay_restore; + delay_data.child_bytes = Config.delay_child_restore; delay_data.last_update = getCurrentTime(); delay_nets[0] = 255; #endif diff --context --recursive squid-1.1.1.ucs.cns/src/comm.h squid-1.1.1.ucs.cns.2/src/comm.h *** squid-1.1.1.ucs.cns/src/comm.h Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/comm.h Tue Dec 17 12:01:18 1996 *************** *** 134,139 **** --- 134,140 ---- struct _delay_data { time_t last_update; long bytes; + long child_bytes; }; extern struct _delay_data delay_data; diff --context --recursive squid-1.1.1.ucs.cns/src/ftp.c squid-1.1.1.ucs.cns.2/src/ftp.c *** squid-1.1.1.ucs.cns/src/ftp.c Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/ftp.c Tue Dec 17 12:42:20 1996 *************** *** 293,301 **** clen = entry->mem_obj->e_current_len; off = storeGetLowestReaderOffset(entry); #ifdef DELAY_HACK ! if (((clen - off) > FTP_DELETE_GAP) || (data->request->delay && ! (((d_m_p = data->request->delay_matrix_pos) != 65535 && delay_matrix[d_m_p] < 0) || ! delay_data.bytes < 0))) { #else if ((clen - off) > FTP_DELETE_GAP) { #endif --- 293,304 ---- clen = entry->mem_obj->e_current_len; off = storeGetLowestReaderOffset(entry); #ifdef DELAY_HACK ! d_m_p = data->request->delay_matrix_pos; ! if (((clen - off) > FTP_DELETE_GAP) || ! (!d_m_p && !data->request->delay && delay_data.child_bytes < 0) || ! (data->request->delay && ! ((d_m_p != 65535 && delay_matrix[d_m_p] < 0) || ! delay_data.bytes < 0))) { #else if ((clen - off) > FTP_DELETE_GAP) { #endif *************** *** 305,311 **** } IOStats.Ftp.reads_deferred++; #ifdef DELAY_HACK ! if (data->request->delay) { debug(11, 2, "ftpReadReply: DELAY Read deferred for Object: %s\n", entry->url); } #endif --- 308,314 ---- } IOStats.Ftp.reads_deferred++; #ifdef DELAY_HACK ! if (data->request->delay || !d_m_p) { debug(11, 2, "ftpReadReply: DELAY Read deferred for Object: %s\n", entry->url); } #endif *************** *** 330,344 **** } errno = 0; #ifdef DELAY_HACK ! if (data->request->delay) { bufsize = delay_data.bytes / 16; if (bufsize < (SQUID_TCP_SO_RCVBUF / 64)) bufsize = SQUID_TCP_SO_RCVBUF / 64; } else bufsize = SQUID_TCP_SO_RCVBUF; len = read(fd, buf, bufsize); if (data->request->delay) { ! delay_data.bytes = delay_data.bytes - len; if(d_m_p == 65535) { unsigned int host, net, Host, Net; --- 333,351 ---- } errno = 0; #ifdef DELAY_HACK ! if (data->request->delay) { bufsize = delay_data.bytes / 16; if (bufsize < (SQUID_TCP_SO_RCVBUF / 64)) bufsize = SQUID_TCP_SO_RCVBUF / 64; + } else if (!d_m_p) { + bufsize = delay_data.child_bytes / 16; + if (bufsize < (SQUID_TCP_SO_RCVBUF / 64)) + bufsize = SQUID_TCP_SO_RCVBUF / 64; } else bufsize = SQUID_TCP_SO_RCVBUF; len = read(fd, buf, bufsize); if (data->request->delay) { ! delay_data.bytes -= len; if(d_m_p == 65535) { unsigned int host, net, Host, Net; *************** *** 368,374 **** delay_matrix[d_m_p] -= len; } else delay_matrix[d_m_p] -= len; ! debug(11, 2, "ftpReadReply: Delay %d bytes read. Pool = %d\n", len, delay_data.bytes); } #else len = read(fd, buf, SQUID_TCP_SO_RCVBUF); --- 375,385 ---- delay_matrix[d_m_p] -= len; } else delay_matrix[d_m_p] -= len; ! debug(11, 2, "ftpReadReply: DELAY %d bytes read. Pool = %d\n", len, delay_data.bytes); ! debug(11, 2, "ftpReadReply: DELAY %d bytes read. Host pool = %d\n", len, delay_matrix[d_m_p]); ! } else if(!d_m_p) { ! delay_data.child_bytes -= len; ! debug(11, 2, "ftpReadReply: DELAY CHILD %d bytes read. Pool = %d\n", len, delay_data.child_bytes); } #else len = read(fd, buf, SQUID_TCP_SO_RCVBUF); diff --context --recursive squid-1.1.1.ucs.cns/src/http.c squid-1.1.1.ucs.cns.2/src/http.c *** squid-1.1.1.ucs.cns/src/http.c Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/http.c Tue Dec 17 12:42:31 1996 *************** *** 545,553 **** clen = entry->mem_obj->e_current_len; off = storeGetLowestReaderOffset(entry); #ifdef DELAY_HACK ! if (((clen - off) > HTTP_DELETE_GAP) || (httpState->request->delay && ! (((d_m_p = httpState->request->delay_matrix_pos) != 65535 && delay_matrix[d_m_p] < 0) || ! delay_data.bytes < 0))) { #else if ((clen - off) > HTTP_DELETE_GAP) { #endif --- 545,556 ---- clen = entry->mem_obj->e_current_len; off = storeGetLowestReaderOffset(entry); #ifdef DELAY_HACK ! d_m_p = httpState->request->delay_matrix_pos; ! if (((clen - off) > HTTP_DELETE_GAP) || ! (!d_m_p && !httpState->request->delay && delay_data.child_bytes < 0) || ! (httpState->request->delay && ! ((d_m_p != 65535 && delay_matrix[d_m_p] < 0) || ! delay_data.bytes < 0))) { #else if ((clen - off) > HTTP_DELETE_GAP) { #endif *************** *** 596,601 **** --- 599,608 ---- bufsize = delay_matrix[d_m_p]; if (bufsize < (SQUID_TCP_SO_RCVBUF / 64)) bufsize = SQUID_TCP_SO_RCVBUF / 64; + } else if (!d_m_p) { + bufsize = delay_data.child_bytes / 16; + if (bufsize < (SQUID_TCP_SO_RCVBUF / 64)) + bufsize = SQUID_TCP_SO_RCVBUF / 64; } else bufsize = SQUID_TCP_SO_RCVBUF; len = read(fd, buf, bufsize); *************** *** 632,639 **** delay_matrix[d_m_p] -= len; debug(11, 2, "httpReadReply: DELAY %d bytes read. Host pool = %d\n", len, delay_matrix[d_m_p]); debug(11, 2, "httpReadReply: DELAY %d bytes read. Pool = %d\n", len, delay_data.bytes); ! } else ! debug(11, 2, "httpReadReply: No DELAY %d bytes read.\n", len); #else len = read(fd, buf, SQUID_TCP_SO_RCVBUF); #endif --- 639,648 ---- delay_matrix[d_m_p] -= len; debug(11, 2, "httpReadReply: DELAY %d bytes read. Host pool = %d\n", len, delay_matrix[d_m_p]); debug(11, 2, "httpReadReply: DELAY %d bytes read. Pool = %d\n", len, delay_data.bytes); ! } else if (!d_m_p) { ! delay_data.child_bytes -= len; ! debug(11, 2, "httpReadReply: DELAY CHILD %d bytes read. Pool = %d\n", len, delay_data.child_bytes); ! } #else len = read(fd, buf, SQUID_TCP_SO_RCVBUF); #endif *************** *** 936,943 **** storeStartDeleteBehind(entry); #ifdef DELAY_HACK ! if (e->options & NEIGHBOR_NO_DELAY) orig_request->delay = 0; #endif /* Create socket. */ --- 945,954 ---- storeStartDeleteBehind(entry); #ifdef DELAY_HACK ! if (e->options & NEIGHBOR_NO_DELAY) { orig_request->delay = 0; + orig_request->delay_matrix_pos = 65535; + } #endif /* Create socket. */ diff --context --recursive squid-1.1.1.ucs.cns/src/icp.c squid-1.1.1.ucs.cns.2/src/icp.c *** squid-1.1.1.ucs.cns/src/icp.c Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/icp.c Tue Dec 17 12:14:15 1996 *************** *** 833,838 **** --- 833,839 ---- fd_table[fd].ipaddr); #ifdef DELAY_HACK icpState->request->delay = 0; + icpState->request->delay_matrix_pos = 65535; #endif icpSendERROR(fd, LOG_TCP_DENIED, buf, icpState, icpState->http_code); return 0; *************** *** 864,871 **** if (aclCheck(DelayAccessList, &ch)) { icpState->request->delay = ntohl(ch.src_addr.s_addr) & 0xffff; /* set delay for this request */ ! debug(12, 5, "icpDelaySet: %s (%d)\n", inet_ntoa(ch.src_addr), icpState->request->delay); } #endif return (protoDispatch(fd, url, icpState->entry, icpState->request)); --- 865,878 ---- if (aclCheck(DelayAccessList, &ch)) { icpState->request->delay = ntohl(ch.src_addr.s_addr) & 0xffff; /* set delay for this request */ ! debug(12, 5, "icpProcessMISS: delay set %s (%d)\n", inet_ntoa(ch.src_addr), icpState->request->delay); + } + if(aclCheck(DelayChildAccessList, &ch)) { + icpState->request->delay_matrix_pos = 0; /* not in the normal delay pool */ + icpState->request->delay = 0; /* special value pair for delay children */ + debug(12, 5, "icpProcessMISS: delay child set %s (%d)\n", inet_ntoa(ch.src_addr), + icpState->request->delay); } #endif return (protoDispatch(fd, url, icpState->entry, icpState->request)); diff --context --recursive squid-1.1.1.ucs.cns/src/squid.conf.pre.in squid-1.1.1.ucs.cns.2/src/squid.conf.pre.in *** squid-1.1.1.ucs.cns/src/squid.conf.pre.in Mon Dec 16 19:19:48 1996 --- squid-1.1.1.ucs.cns.2/src/squid.conf.pre.in Tue Dec 17 12:34:45 1996 *************** *** 770,775 **** --- 770,816 ---- # to fetch MISSES from us. miss_access allow all + # TAG: delay_access + # + # Set this for hosts to be in the unified and per-host delay pools. + delay_access deny all + + # TAG: delay_child_access + # + # Set this for hosts to use the child delay pool. This removes + # them from the unified or per-host delay pools if they were in them. + delay_child_access deny all + + # TAG: delay_max + # + # The maximum bytes in the unified delay pool. + #delay_max 102400 + + # TAG: delay_restore + # + # The bytes per second added to the unified delay pool. + #delay_restore 3584 + + # TAG: delay_host_max + # + # The maximum bytes per host in the per-host delay pool. + #delay_host_max 10240 + + # TAG: delay_host_restore + # + # The bytes per second added to each host in the unified delay pool. + #delay_host_restore 384 + + # TAG: delay_child_max + # + # The maximum bytes in the child delay pool. + #delay_child_max 204800 + + # TAG: delay_child_restore + # + # The bytes per second added to the child delay pool. + #delay_child_restore 8192 + # TAG: cache_host_acl # Just like 'cache_host_domain' but provides more flexibility by # using ACL's. diff --context --recursive squid-1.1.1.ucs.cns/src/stat.c squid-1.1.1.ucs.cns.2/src/stat.c *** squid-1.1.1.ucs.cns/src/stat.c Mon Dec 16 19:20:54 1996 --- squid-1.1.1.ucs.cns.2/src/stat.c Tue Dec 17 12:26:16 1996 *************** *** 301,306 **** --- 301,307 ---- storeAppendPrintf(sentry, open_bracket); storeAppendPrintf(sentry, "{Delay Statistics}\n"); storeAppendPrintf(sentry, "{unified delay pool: %d}\n", delay_data.bytes); + storeAppendPrintf(sentry, "{children delay pool: %d}\n", delay_data.child_bytes); storeAppendPrintf(sentry, "{}\n"); for (i = 0; delay_nets[i] != 255; i++) { storeAppendPrintf(sentry, "{Network %d:", delay_nets[i]);