diff --context --recursive squid-1.1.0.ucs/src/Makefile.in squid-1.1.0.ucs.cns/src/Makefile.in *** squid-1.1.0.ucs/src/Makefile.in Tue Dec 10 11:07:01 1996 --- squid-1.1.0.ucs.cns/src/Makefile.in Tue Dec 10 13:17:19 1996 *************** *** 9,15 **** AUTH_OPT = # -DUSE_PROXY_AUTH=1 LOG_HDRS_OPT = # -DLOG_FULL_HEADERS=1 ICMP_OPT = # -DUSE_ICMP=1 ! DELAY_HACK = # -DDELAY_HACK=1 USERAGENT_OPT = # -DUSE_USERAGENT_LOG=1 KILL_PARENT_OPT = # -DKILL_PARENT_OPT USE_POLL_OPT = # -DUSE_POLL --- 9,15 ---- AUTH_OPT = # -DUSE_PROXY_AUTH=1 LOG_HDRS_OPT = # -DLOG_FULL_HEADERS=1 ICMP_OPT = # -DUSE_ICMP=1 ! DELAY_HACK = -DDELAY_HACK=1 USERAGENT_OPT = # -DUSE_USERAGENT_LOG=1 KILL_PARENT_OPT = # -DKILL_PARENT_OPT USE_POLL_OPT = # -DUSE_POLL diff --context --recursive squid-1.1.0.ucs/src/acl.c squid-1.1.0.ucs.cns/src/acl.c *** squid-1.1.0.ucs/src/acl.c Wed Dec 4 04:26:47 1996 --- squid-1.1.0.ucs.cns/src/acl.c Tue Dec 10 11:46:23 1996 *************** *** 42,48 **** struct _acl_access *HTTPAccessList = NULL; struct _acl_access *ICPAccessList = NULL; struct _acl_access *MISSAccessList = NULL; ! #if DELAY_HACK struct _acl_access *DelayAccessList = NULL; #endif --- 42,48 ---- struct _acl_access *HTTPAccessList = NULL; struct _acl_access *ICPAccessList = NULL; struct _acl_access *MISSAccessList = NULL; ! #ifdef DELAY_HACK struct _acl_access *DelayAccessList = NULL; #endif diff --context --recursive squid-1.1.0.ucs/src/acl.h squid-1.1.0.ucs.cns/src/acl.h *** squid-1.1.0.ucs/src/acl.h Fri Nov 15 08:36:13 1996 --- squid-1.1.0.ucs.cns/src/acl.h Tue Dec 10 11:46:41 1996 *************** *** 147,152 **** extern struct _acl_deny_info_list *DenyInfoList; extern const char *AclMatchedName; ! #if DELAY_HACK extern struct _acl_access *DelayAccessList; #endif --- 147,152 ---- extern struct _acl_deny_info_list *DenyInfoList; extern const char *AclMatchedName; ! #ifdef DELAY_HACK extern struct _acl_access *DelayAccessList; #endif diff --context --recursive squid-1.1.0.ucs/src/cache_cf.c squid-1.1.0.ucs.cns/src/cache_cf.c *** squid-1.1.0.ucs/src/cache_cf.c Fri Dec 6 06:47:12 1996 --- squid-1.1.0.ucs.cns/src/cache_cf.c Tue Dec 10 13:18:33 1996 *************** *** 116,121 **** --- 116,128 ---- #define DefaultNetdbHigh 1000 /* counts, not percents */ #define DefaultNetdbLow 900 + #ifdef DELAY_HACK + #define DefaultDelayMaxBytes 100000 + #define DefaultDelayRestoreBytes 10000 + #define DefaultDelayHostMaxBytes 20000 + #define DefaultDelayHostRestoreBytes 2000 + #endif + #define DefaultWaisRelayHost (char *)NULL #define DefaultWaisRelayPort 0 *************** *** 228,233 **** --- 235,246 ---- static void parseCacheAnnounceLine _PARAMS((void)); static void parseCacheHostLine _PARAMS((void)); static void parseDebugOptionsLine _PARAMS((void)); + #ifdef DELAY_HACK + static void parseDelayRestoreLine _PARAMS((void)); + static void parseDelayHostRestoreLine _PARAMS((void)); + static void parseDelayMaxLine _PARAMS((void)); + static void parseDelayHostMaxLine _PARAMS((void)); + #endif static void parseEffectiveUserLine _PARAMS((void)); static void parseErrHtmlLine _PARAMS((void)); static void parseFtpOptionsLine _PARAMS((void)); *************** *** 489,494 **** --- 502,511 ---- options |= NEIGHBOR_PROXY_ONLY; } else if (!strcasecmp(token, "no-query")) { options |= NEIGHBOR_NO_QUERY; + #ifdef DELAY_HACK + } else if (!strcasecmp(token, "no-delay")) { + options |= NEIGHBOR_NO_DELAY; + #endif } else if (!strncasecmp(token, "weight=", 7)) { weight = atoi(token + 7); } else if (!strncasecmp(token, "ttl=", 4)) { *************** *** 878,883 **** --- 895,938 ---- Config.debugOptions = xstrdup(token); } + #ifdef DELAY_HACK + static + void parseDelayRestoreLine() + { + char *token; + int i; + GetInteger(i); + Config.delay_restore = i; /* number of bytes per sec to give to pool */ + } + + static void + parseDelayHostRestoreLine() + { + char *token; + int i; + GetInteger(i); + Config.delay_host_restore = i; /* ditto, per-host pool */ + } + + static void + parseDelayMaxLine() + { + char *token; + int i; + GetInteger(i); + Config.delay_max = i; /* max number of bytes in pool */ + } + + static void + parseDelayHostMaxLine() + { + char *token; + int i; + GetInteger(i); + Config.delay_host_max = i; /* ditto, per-host pool */ + } + #endif + static void parseVisibleHostnameLine(void) { *************** *** 1041,1047 **** aclDestroyAccessList(&HTTPAccessList); aclDestroyAccessList(&MISSAccessList); aclDestroyAccessList(&ICPAccessList); ! #if DELAY_HACK aclDestroyAccessList(&DelayAccessList); #endif aclDestroyRegexList(Config.cache_stop_relist); --- 1096,1102 ---- aclDestroyAccessList(&HTTPAccessList); aclDestroyAccessList(&MISSAccessList); aclDestroyAccessList(&ICPAccessList); ! #ifdef DELAY_HACK aclDestroyAccessList(&DelayAccessList); #endif aclDestroyRegexList(Config.cache_stop_relist); *************** *** 1166,1174 **** else if (!strcmp(token, "cache_stoplist_pattern/i")) parseStoplistPattern(1); ! #if DELAY_HACK else if (!strcmp(token, "delay_access")) aclParseAccessLine(&DelayAccessList); #endif else if (!strcmp(token, "refresh_pattern")) --- 1221,1241 ---- else if (!strcmp(token, "cache_stoplist_pattern/i")) parseStoplistPattern(1); ! #ifdef DELAY_HACK else if (!strcmp(token, "delay_access")) aclParseAccessLine(&DelayAccessList); + + else if (!strcmp(token, "delay_max")) + parseDelayMaxLine(); + + else if (!strcmp(token, "delay_restore")) + parseDelayRestoreLine(); + + else if (!strcmp(token, "delay_host_max")) + parseDelayHostMaxLine(); + + else if (!strcmp(token, "delay_host_restore")) + parseDelayHostRestoreLine(); #endif else if (!strcmp(token, "refresh_pattern")) *************** *** 1548,1553 **** --- 1615,1626 ---- Config.proxyAuthIgnoreDomain = safe_xstrdup(DefaultProxyAuthIgnoreDomain); #endif /* USE_PROXY_AUTH */ Config.ftpUser = safe_xstrdup(DefaultFtpUser); + #ifdef DELAY_HACK + Config.delay_max = DefaultDelayMaxBytes; + Config.delay_restore = DefaultDelayRestoreBytes; + Config.delay_host_max = DefaultDelayHostMaxBytes; + Config.delay_host_restore = DefaultDelayHostRestoreBytes; + #endif Config.Announce.host = safe_xstrdup(DefaultAnnounceHost); Config.Announce.port = DefaultAnnouncePort; Config.Announce.file = safe_xstrdup(DefaultAnnounceFile); diff --context --recursive squid-1.1.0.ucs/src/cache_cf.h squid-1.1.0.ucs.cns/src/cache_cf.h *** squid-1.1.0.ucs/src/cache_cf.h Fri Dec 6 06:47:13 1996 --- squid-1.1.0.ucs.cns/src/cache_cf.h Tue Dec 10 11:45:05 1996 *************** *** 202,207 **** --- 202,213 ---- int neighborTimeout; int stallDelay; int singleParentBypass; + #ifdef DELAY_HACK + int delay_restore; + int delay_max; + int delay_host_restore; + int delay_host_max; + #endif struct { char *host; char *prefix; diff --context --recursive squid-1.1.0.ucs/src/cachemgr.c squid-1.1.0.ucs.cns/src/cachemgr.c *** squid-1.1.0.ucs/src/cachemgr.c Mon Nov 25 14:15:29 1996 --- squid-1.1.0.ucs.cns/src/cachemgr.c Tue Dec 10 11:53:35 1996 *************** *** 231,236 **** --- 231,239 ---- STATS_VM, STATS_U, STATS_IO, + #ifdef DELAY_HACK + STATS_DH, + #endif STATS_HDRS, STATS_FDS, STATS_NETDB, *************** *** 258,263 **** --- 261,269 ---- "stats/vm_objects", "stats/utilization", "stats/io", + #ifdef DELAY_HACK + "stats/delay", + #endif "stats/reply_headers", "stats/filedescriptors", "stats/netdb", *************** *** 285,290 **** --- 291,299 ---- "VM Objects", "Utilization", "I/O", + #ifdef DELAY_HACK + "Delay Pool Statistics", + #endif "HTTP Reply Headers", "Filedescriptor Usage", "Network Probe Database", *************** *** 370,375 **** --- 379,387 ---- #endif print_option(op, STATS_U); print_option(op, STATS_IO); + #ifdef DELAY_HACK + print_option(op, STATS_DH); + #endif print_option(op, STATS_HDRS); print_option(op, STATS_FDS); print_option(op, STATS_NETDB); *************** *** 738,743 **** --- 750,758 ---- case STATS_VM: case STATS_U: case STATS_IO: + #ifdef DELAY_HACK + case STATS_DH: + #endif case STATS_HDRS: case STATS_FDS: case STATS_NETDB: *************** *** 777,782 **** --- 792,800 ---- #endif print_option(op, STATS_U); print_option(op, STATS_IO); + #ifdef DELAY_HACK + print_option(op, STATS_DH); + #endif print_option(op, STATS_HDRS); print_option(op, STATS_FDS); print_option(op, STATS_NETDB); *************** *** 833,838 **** --- 851,859 ---- case STATS_O: case STATS_VM: case STATS_IO: + #ifdef DELAY_HACK + case STATS_DH: + #endif case STATS_HDRS: case STATS_FDS: case STATS_NETDB: *************** *** 919,924 **** --- 940,948 ---- case STATS_D: case STATS_R: case STATS_IO: + #ifdef DELAY_HACK + case STATS_DH: + #endif case STATS_HDRS: case STATS_FDS: case STATS_NETDB: diff --context --recursive squid-1.1.0.ucs/src/comm.c squid-1.1.0.ucs.cns/src/comm.c *** squid-1.1.0.ucs/src/comm.c Fri Dec 6 13:44:41 1996 --- squid-1.1.0.ucs.cns/src/comm.c Tue Dec 10 13:22:43 1996 *************** *** 131,136 **** --- 131,143 ---- void (*free) (void *); }; + #ifdef DELAY_HACK + struct _delay_data delay_data; + unsigned char delay_nets[256]; + unsigned char delay_hosts[255][256]; + long delay_matrix[65279]; + #endif + /* GLOBAL */ FD_ENTRY *fd_table = NULL; /* also used in disk.c */ *************** *** 914,919 **** --- 921,931 ---- static time_t last_timeout = 0; struct timeval poll_time; time_t timeout; + #ifdef DELAY_HACK + long maxbyte, restbyte; + int net, host, mpos; + int time_diff; + #endif /* assume all process are very fast (less than 1 second). Call * time() only once */ *************** *** 921,926 **** --- 933,970 ---- /* use only 1 second granularity */ timeout = squid_curtime + sec; + #ifdef DELAY_HACK + 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++) { + if(delay_nets[net] == 255) + break; + debug(5, 2, "comm_select: DELAY incrementing net %d\n", net); + for(host=0;;host++) { + if(delay_hosts[net][host] == 255) + break; + debug(5, 2, "comm_select: DELAY incrementing host %d\n", host); + mpos = (net << 8) + host; + if(delay_matrix[mpos] != maxbyte) { + delay_matrix[mpos] += restbyte; + if(delay_matrix[mpos] > maxbyte) + delay_matrix[mpos] = maxbyte; + } + } + } + } + #endif + do { if (sec > 60) fatal_dump(NULL); *************** *** 988,994 **** continue; /* scan each socket but the accept socket. Poll this ! * more frequently to minimiize losses due to the 5 connect * limit in SunOS */ for (fd = 0; fd < maxfd; fd++) { --- 1032,1038 ---- continue; /* scan each socket but the accept socket. Poll this ! * more frequently to minimize losses due to the 5 connect * limit in SunOS */ for (fd = 0; fd < maxfd; fd++) { *************** *** 1244,1249 **** --- 1288,1301 ---- meta_data.misc += SQUID_MAXFD * sizeof(int); zero_tv.tv_sec = 0; zero_tv.tv_usec = 0; + + #ifdef DELAY_HACK + /* this bit sets up the structure that holds the delay_data info. */ + + delay_data.bytes = Config.delay_restore; + delay_data.last_update = getCurrentTime(); + delay_nets[0] = 255; + #endif return 0; } diff --context --recursive squid-1.1.0.ucs/src/comm.h squid-1.1.0.ucs.cns/src/comm.h *** squid-1.1.0.ucs/src/comm.h Thu Nov 7 07:14:25 1996 --- squid-1.1.0.ucs.cns/src/comm.h Tue Dec 10 11:31:19 1996 *************** *** 130,135 **** --- 130,147 ---- #define FD_ASCII_NOTE_SZ 64 + #ifdef DELAY_HACK + struct _delay_data { + time_t last_update; + long bytes; + }; + + extern struct _delay_data delay_data; + extern unsigned char delay_nets[256]; + extern unsigned char delay_hosts[255][256]; + extern long delay_matrix[65279]; + #endif + struct close_handler { PF handler; void *data; diff --context --recursive squid-1.1.0.ucs/src/ftp.c squid-1.1.0.ucs.cns/src/ftp.c *** squid-1.1.0.ucs/src/ftp.c Wed Dec 4 07:30:47 1996 --- squid-1.1.0.ucs.cns/src/ftp.c Tue Dec 10 13:23:40 1996 *************** *** 277,282 **** --- 277,285 ---- int clen; int off; int bin; + #ifdef DELAY_HACK + int bufsize, d_m_p; + #endif StoreEntry *entry = NULL; entry = data->entry; *************** *** 289,300 **** --- 292,314 ---- /* check if we want to defer reading */ 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 if (entry->flag & CLIENT_ABORT_REQUEST) { squid_error_entry(entry, ERR_CLIENT_ABORT, NULL); comm_close(fd); } 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 debug(11, 3, "ftpReadReply: Read deferred for Object: %s\n", entry->url); debug(11, 3, " Current Gap: %d bytes\n", clen - off); *************** *** 315,321 **** --- 329,378 ---- BIT_RESET(entry->flag, READ_DEFERRED); } 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; + + Host = data->request->delay & 0xff; + Net = data->request->delay >> 8; + for(net = 0;; net++) { + if(delay_nets[net] == Net) + break; + if(delay_nets[net] == 255) { + delay_nets[net] = Net; + delay_nets[net + 1] = 255; + delay_hosts[net][0] = 255; + break; + } + } + for(host = 0;; host++) { + if(delay_hosts[net][host] == Host) + break; + if(delay_hosts[net][host] == 255) { + delay_hosts[net][host] = Host; + delay_hosts[net][host + 1] = 255; + delay_matrix[(net << 8) + host] = Config.delay_host_restore; + break; + } + } + d_m_p = data->request->delay_matrix_pos = (net << 8) + host; + 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); + #endif debug(9, 5, "ftpReadReply: FD %d, Read %d bytes\n", fd, len); if (len > 0) { IOStats.Ftp.reads++; diff --context --recursive squid-1.1.0.ucs/src/http.c squid-1.1.0.ucs.cns/src/http.c *** squid-1.1.0.ucs/src/http.c Sat Dec 7 05:52:01 1996 --- squid-1.1.0.ucs.cns/src/http.c Tue Dec 10 13:23:59 1996 *************** *** 110,115 **** --- 110,116 ---- #include "squid.h" + #define HTTP_DELETE_GAP (1<<18) static const char *const w_space = " \t\n\r"; *************** *** 473,478 **** --- 474,482 ---- int bin; int clen; int off; + #ifdef DELAY_HACK + int bufsize, d_m_p; + #endif StoreEntry *entry = NULL; entry = httpState->entry; *************** *** 485,497 **** --- 489,513 ---- /* check if we want to defer reading */ 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 if (entry->flag & CLIENT_ABORT_REQUEST) { squid_error_entry(entry, ERR_CLIENT_ABORT, NULL); comm_close(fd); return; } IOStats.Http.reads_deferred++; + #ifdef DELAY_HACK + if (httpState->request->delay) { + debug(11, 2, "httpReadReply: DELAY Read deferred for Object: %s\n", entry->url); + } + #endif + debug(11, 3, "httpReadReply: Read deferred for Object: %s\n", entry->url); debug(11, 3, " Current Gap: %d bytes\n", clen - off); *************** *** 518,525 **** --- 534,589 ---- BIT_RESET(entry->flag, READ_DEFERRED); } errno = 0; + #ifdef DELAY_HACK + if (httpState->request->delay != 0) { + bufsize = delay_data.bytes / 16; + if(d_m_p != 65535 && bufsize > delay_matrix[d_m_p]) + bufsize = delay_matrix[d_m_p]; + 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 (httpState->request->delay != 0) { + delay_data.bytes -= len; + if(d_m_p == 65535) { + unsigned int host, net, Host, Net; + + Host = httpState->request->delay & 0xff; + Net = httpState->request->delay >> 8; + for(net = 0;; net++) { + if(delay_nets[net] == Net) + break; + if(delay_nets[net] == 255) { + delay_nets[net] = Net; + delay_nets[net + 1] = 255; + delay_hosts[net][0] = 255; + break; + } + } + for(host = 0;; host++) { + if(delay_hosts[net][host] == Host) + break; + if(delay_hosts[net][host] == 255) { + delay_hosts[net][host] = Host; + delay_hosts[net][host + 1] = 255; + delay_matrix[(net << 8) + host] = Config.delay_host_restore; + break; + } + } + d_m_p = httpState->request->delay_matrix_pos = (net << 8) + host; + delay_matrix[d_m_p] -= len; + } else + 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 debug(11, 5, "httpReadReply: FD %d: len %d.\n", fd, len); + comm_set_fd_lifetime(fd, 86400); /* extend after good read */ if (len > 0) { IOStats.Http.reads++; *************** *** 824,829 **** --- 888,898 ---- if (e->options & NEIGHBOR_PROXY_ONLY) storeStartDeleteBehind(entry); + #ifdef DELAY_HACK + if (e->options & NEIGHBOR_NO_DELAY) + orig_request->delay = 0; + #endif + /* Create socket. */ sock = comm_open(SOCK_STREAM, 0, *************** *** 841,846 **** --- 910,919 ---- httpState->req_hdr = entry->mem_obj->mime_hdr; httpState->req_hdr_sz = entry->mem_obj->mime_hdr_sz; request = get_free_request_t(); + #ifdef DELAY_HACK + request->delay = orig_request->delay; + request->delay_matrix_pos = orig_request->delay_matrix_pos; + #endif httpState->request = requestLink(request); httpState->neighbor = e; httpState->orig_request = requestLink(orig_request); diff --context --recursive squid-1.1.0.ucs/src/icp.c squid-1.1.0.ucs.cns/src/icp.c *** squid-1.1.0.ucs/src/icp.c Tue Dec 10 11:07:01 1996 --- squid-1.1.0.ucs.cns/src/icp.c Tue Dec 10 12:42:35 1996 *************** *** 149,157 **** "ERR_PROXY_DENIED" }; - #if DELAY_HACK - int _delay_fetch; - #endif static icpUdpData *UdpQueueHead = NULL; static icpUdpData *UdpQueueTail = NULL; --- 149,154 ---- *************** *** 865,870 **** --- 862,870 ---- icpState->method, icpState->url, fd_table[fd].ipaddr); + #ifdef DELAY_HACK + icpState->request->delay = 0; + #endif icpSendERROR(fd, LOG_TCP_DENIED, buf, icpState, icpState->http_code); return 0; } *************** *** 887,898 **** icpState->offset = 0; /* Register with storage manager to receive updates when data comes in. */ storeRegister(entry, fd, icpHandleStore, (void *) icpState); ! #if DELAY_HACK ch.src_addr = icpState->peer.sin_addr; ch.request = icpState->request; ! _delay_fetch = 0; ! if (aclCheck(DelayAccessList, &ch)) ! _delay_fetch = 1; #endif return (protoDispatch(fd, url, icpState->entry, icpState->request)); } --- 887,903 ---- icpState->offset = 0; /* Register with storage manager to receive updates when data comes in. */ storeRegister(entry, fd, icpHandleStore, (void *) icpState); ! #ifdef DELAY_HACK ch.src_addr = icpState->peer.sin_addr; ch.request = icpState->request; ! icpState->request->delay = 0; /* no delay until determined */ ! icpState->request->delay_matrix_pos = 65535; /* not located */ ! 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)); } diff --context --recursive squid-1.1.0.ucs/src/neighbors.h squid-1.1.0.ucs.cns/src/neighbors.h *** squid-1.1.0.ucs/src/neighbors.h Wed Nov 27 07:22:18 1996 --- squid-1.1.0.ucs.cns/src/neighbors.h Tue Dec 10 13:00:35 1996 *************** *** 153,158 **** --- 153,161 ---- #define NEIGHBOR_PROXY_ONLY 0x01 #define NEIGHBOR_NO_QUERY 0x02 #define NEIGHBOR_DEFAULT_PARENT 0x04 + #ifdef DELAY_HACK + #define NEIGHBOR_NO_DELAY 0x08 + #endif #define EDGE_MAX_ADDRESSES 10 #define RTT_AV_FACTOR 1000 diff --context --recursive squid-1.1.0.ucs/src/objcache.c squid-1.1.0.ucs.cns/src/objcache.c *** squid-1.1.0.ucs/src/objcache.c Thu Nov 28 15:28:25 1996 --- squid-1.1.0.ucs.cns/src/objcache.c Tue Dec 10 12:59:11 1996 *************** *** 165,170 **** --- 165,174 ---- op = MGR_REDIRECTORS; else if (!strcmp(buf, "stats/io")) op = MGR_IO; + #ifdef DELAY_HACK + else if (!strcmp(buf, "stats/delay")) + op = MGR_DELAY; + #endif else if (!strcmp(buf, "stats/reply_headers")) op = MGR_REPLY_HDRS; else if (!strcmp(buf, "stats/filedescriptors")) *************** *** 290,295 **** --- 294,304 ---- case MGR_IO: HTTPCacheInfo->stat_get(HTTPCacheInfo, "io", entry); break; + #ifdef DELAY_HACK + case MGR_DELAY: + HTTPCacheInfo->stat_get(HTTPCacheInfo, "delay", entry); + break; + #endif case MGR_REPLY_HDRS: HTTPCacheInfo->stat_get(HTTPCacheInfo, "reply_headers", entry); break; diff --context --recursive squid-1.1.0.ucs/src/objcache_opcodes.h squid-1.1.0.ucs.cns/src/objcache_opcodes.h *** squid-1.1.0.ucs/src/objcache_opcodes.h Wed Nov 6 01:08:19 1996 --- squid-1.1.0.ucs.cns/src/objcache_opcodes.h Tue Dec 10 12:59:42 1996 *************** *** 11,16 **** --- 11,19 ---- MGR_FQDNCACHE, MGR_INFO, MGR_IO, + #ifdef DELAY_HACK + MGR_DELAY, + #endif MGR_IPCACHE, MGR_LOG_CLEAR, MGR_LOG_DISABLE, *************** *** 41,46 **** --- 44,52 ---- "fqdncache", "info", "io", + #ifdef DELAY_HACK + "delay", + #endif "ipcache", "log/clear", "log/disable", diff --context --recursive squid-1.1.0.ucs/src/proto.c squid-1.1.0.ucs.cns/src/proto.c *** squid-1.1.0.ucs/src/proto.c Wed Nov 27 03:07:28 1996 --- squid-1.1.0.ucs.cns/src/proto.c Tue Dec 10 12:48:07 1996 *************** *** 155,164 **** "ICP_END" }; - #if DELAY_HACK - extern int _delay_fetch; - #endif - static void protoDataFree(int fdunused, protodispatch_data * protoData) { --- 155,160 ---- *************** *** 256,265 **** (PF) getFromDefaultSource, (void *) entry, Config.neighborTimeout); - #ifdef DELAY_HACK - if (protoData->delay_fetch && entry->mem_obj) - entry->mem_obj->e_pings_n_pings++; - #endif return; } if ((e = protoData->default_parent)) { --- 252,257 ---- *************** *** 310,318 **** protoData->single_parent = getSingleParent(request); protoData->default_parent = getDefaultParent(request); protoData->n_edges = neighborsCount(request); - #ifdef DELAY_HACK - protoData->delay_fetch = _delay_fetch; - #endif debug(17, 2, "protoDispatch: inside_firewall = %d (%s)\n", protoData->inside_firewall, --- 302,307 ---- diff --context --recursive squid-1.1.0.ucs/src/proto.h squid-1.1.0.ucs.cns/src/proto.h *** squid-1.1.0.ucs/src/proto.h Wed Nov 27 03:07:29 1996 --- squid-1.1.0.ucs.cns/src/proto.h Tue Dec 10 12:48:21 1996 *************** *** 287,295 **** int n_edges; struct _edge *single_parent; struct _edge *default_parent; - #if DELAY_HACK - int delay_fetch; - #endif } protodispatch_data; extern int protoDispatch _PARAMS((int, char *, StoreEntry *, request_t *)); --- 287,292 ---- diff --context --recursive squid-1.1.0.ucs/src/stat.c squid-1.1.0.ucs.cns/src/stat.c *** squid-1.1.0.ucs/src/stat.c Tue Dec 10 11:07:01 1996 --- squid-1.1.0.ucs.cns/src/stat.c Tue Dec 10 11:31:19 1996 *************** *** 292,297 **** --- 292,317 ---- storeAppendPrintf(sentry, close_bracket); } + #ifdef DELAY_HACK + void stat_delay_get(sentry) + StoreEntry *sentry; + { + int i, j; + + storeAppendPrintf(sentry, open_bracket); + storeAppendPrintf(sentry, "{Delay Statistics}\n"); + storeAppendPrintf(sentry, "{unified delay pool: %d}\n", delay_data.bytes); + storeAppendPrintf(sentry, "{}\n"); + for (i = 0; delay_nets[i] != 255; i++) { + storeAppendPrintf(sentry, "{Network %d:", delay_nets[i]); + for (j = 0; delay_hosts[i][j] != 255; j++) + storeAppendPrintf(sentry, " %d: %d", delay_hosts[i][j], delay_matrix[(i<<8)+j]); + storeAppendPrintf(sentry, "}\n"); + } + storeAppendPrintf(sentry, close_bracket); + } + #endif + /* return total bytes of all registered and known objects. * may not reflect the retrieving object.... *************** *** 429,434 **** --- 449,458 ---- stat_utilization_get(ICPCacheInfo, sentry, "ICP"); } else if (strcmp(req, "io") == 0) { stat_io_get(sentry); + #ifdef DELAY_HACK + } else if (strcmp(req, "delay") == 0) { + stat_delay_get(sentry); + #endif } else if (strcmp(req, "reply_headers") == 0) { httpReplyHeaderStats(sentry); } else if (strcmp(req, "filedescriptors") == 0) { diff --context --recursive squid-1.1.0.ucs/src/url.h squid-1.1.0.ucs.cns/src/url.h *** squid-1.1.0.ucs/src/url.h Thu Nov 28 15:27:24 1996 --- squid-1.1.0.ucs.cns/src/url.h Tue Dec 10 12:46:27 1996 *************** *** 67,72 **** --- 67,75 ---- int flags; time_t max_age; float http_ver; + #ifdef DELAY_HACK + unsigned int delay, delay_matrix_pos; + #endif }; extern char *url_convert_hex _PARAMS((char *org_url, int allocate));