From: wessels <> Date: Wed, 28 Aug 1996 23:44:28 +0000 (+0000) Subject: Made IP cache size configurable X-Git-Tag: SQUID_3_0_PRE1~5891 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b15e6857fab626d5700bbef2ae0af47893b9a6be;p=thirdparty%2Fsquid.git Made IP cache size configurable --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 7ddee840b1..97f8a3226b 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.75 1996/08/27 17:55:18 wessels Exp $ + * $Id: cache_cf.cc,v 1.76 1996/08/28 17:44:28 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -186,9 +186,12 @@ struct SquidConfig Config; #define DefaultTcpOutgoingAddr INADDR_NONE #define DefaultUdpIncomingAddr INADDR_ANY #define DefaultUdpOutgoingAddr INADDR_NONE -#define DefaultClientNetmask 0xFFFFFFFF; +#define DefaultClientNetmask 0xFFFFFFFF #define DefaultSslProxyPort 0 #define DefaultSslProxyHost (char *)NULL +#define DefaultIpcacheSize 1024 +#define DefaultIpcacheLow 90 +#define DefaultIpcacheHigh 95 int httpd_accel_mode = 0; /* for fast access */ char *DefaultSwapDir = DEFAULT_SWAP_DIR; @@ -1322,6 +1325,13 @@ int parseConfigFile(file_name) else if (!strcmp(token, "err_html_text")) parseErrHtmlLine(); + else if (!strcmp(token, "ipcache_size")) + parseIntegerValue(&Config.ipcache.size); + else if (!strcmp(token, "ipcache_low")) + parseIntegerValue(&Config.ipcache.low); + else if (!strcmp(token, "ipcache_high")) + parseIntegerValue(&Config.ipcache.high); + else { debug(3, 0, "parseConfigFile: line %d unrecognized: '%s'\n", config_lineno, @@ -1520,6 +1530,9 @@ static void configSetFactoryDefaults() Config.Addrs.client_netmask.s_addr = DefaultClientNetmask; Config.sslProxy.port = DefaultSslProxyPort; Config.sslProxy.host = safe_xstrdup(DefaultSslProxyHost); + Config.ipcache.size = DefaultIpcacheSize; + Config.ipcache.low = DefaultIpcacheLow; + Config.ipcache.high = DefaultIpcacheHigh; } static void configDoConfigure() diff --git a/src/ipcache.cc b/src/ipcache.cc index 4a4d06b714..fa63118508 100644 --- a/src/ipcache.cc +++ b/src/ipcache.cc @@ -1,5 +1,5 @@ /* - * $Id: ipcache.cc,v 1.48 1996/08/28 17:34:29 wessels Exp $ + * $Id: ipcache.cc,v 1.49 1996/08/28 17:44:30 wessels Exp $ * * DEBUG: section 14 IP Cache * AUTHOR: Harvest Derived @@ -107,7 +107,6 @@ #define MAX_LINELEN (4096) -#define MAX_IP 1024 /* Maximum cached IP */ #define IP_LOW_WATER 90 #define IP_HIGH_WATER 95 #define MAX_HOST_NAME 256 @@ -796,10 +795,10 @@ void ipcache_init() *(static_result->h_addr_list + 0) = xcalloc(1, 4); static_result->h_name = xcalloc(1, MAX_HOST_NAME + 1); - ipcache_high = (long) (((float) MAX_IP * - (float) IP_HIGH_WATER) / (float) 100); - ipcache_low = (long) (((float) MAX_IP * - (float) IP_LOW_WATER) / (float) 100); + ipcache_high = (long) (((float) Config.ipcache.size * + (float) Config.ipcache.high) / (float) 100); + ipcache_low = (long) (((float) Config.ipcache.size * + (float) Config.ipcache.low) / (float) 100); } /* clean up the pending entries in dnsserver */