From: wessels <> Date: Tue, 15 Jul 1997 05:44:57 +0000 (+0000) Subject: - warning if no units present for times or byte sizes X-Git-Tag: SQUID_3_0_PRE1~4893 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9e975e4e285472da81c0d6cffc4a55e9fb0b4483;p=thirdparty%2Fsquid.git - warning if no units present for times or byte sizes - added defaults to all time_t's in cf.data.pre - Fixed up connect callbacks to recognize COMM_DNS_ERR and !COMM_OK - Set FTP_HTTP_HEADER_SENT for ftp - Initialize neighbors_do_private_keys in globals.c - Remove opt_no_ipcache - removed redundant externs from squid.h - changed more debug_trap's to assert's - changed over-high-water-mark warning to only report once at each threshold --- diff --git a/src/cache_cf.cc b/src/cache_cf.cc index b085f4fae0..d76626d280 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,5 +1,5 @@ /* - * $Id: cache_cf.cc,v 1.204 1997/07/14 21:11:00 wessels Exp $ + * $Id: cache_cf.cc,v 1.205 1997/07/14 23:44:57 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -258,10 +258,11 @@ parseTimeLine(time_t *tptr, const char *units) self_destruct(); d = atof(token); m = u; /* default to 'units' if none specified */ - if ((token = strtok(NULL, w_space)) != NULL) { - if ((m = parseTimeUnits(token)) == 0) + if ((token = strtok(NULL, w_space)) == NULL) + debug(3,0)("WARNING: No units on '%s', assuming %f %s\n", + config_input_line, d, units); + else if ((m = parseTimeUnits(token)) == 0) self_destruct(); - } *tptr = m * d / u; } @@ -291,7 +292,7 @@ parseTimeUnits(const char *unit) } static void -parseBytesLine(size_t *bptr, const char *units) +parseBytesLine(size_t * bptr, const char *units) { char *token; double d; @@ -303,10 +304,11 @@ parseBytesLine(size_t *bptr, const char *units) self_destruct(); d = atof(token); m = u; /* default to 'units' if none specified */ - if ((token = strtok(NULL, w_space)) != NULL) { - if ((m = parseBytesUnits(token)) == 0) - self_destruct(); - } + if ((token = strtok(NULL, w_space)) == NULL) + debug(3, 0) ("WARNING: No units on '%s', assuming %f %s\n", + config_input_line, d, units); + else if ((m = parseBytesUnits(token)) == 0) + self_destruct(); *bptr = m * d / u; } diff --git a/src/cf.data.pre b/src/cf.data.pre index 8008eb27ea..9cb2c9c6cd 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -293,7 +293,7 @@ DOC_END NAME: neighbor_timeout neighbour_timeout COMMENT: (seconds) -DEFAULT: 2 +DEFAULT: 2 seconds TYPE: time_t LOC: Config.neighborTimeout DOC_START @@ -437,8 +437,8 @@ DOC_END NAME: maximum_object_size -COMMENT: (KB) -TYPE: kb_size_t +COMMENT: (bytes) +TYPE: size_t DEFAULT: 4096 KB LOC: Config.Store.maxObjectSize DOC_START @@ -897,7 +897,7 @@ DOC_END NAME: quick_abort_min COMMENT: (KB) TYPE: kb_size_t -DEFAULT: -1 +DEFAULT: -1 kb LOC: Config.quickAbort.min DOC_NONE @@ -911,7 +911,7 @@ DOC_NONE NAME: quick_abort_max COMMENT: (KB) TYPE: kb_size_t -DEFAULT: 0 +DEFAULT: 0 kb LOC: Config.quickAbort.max DOC_START By default the cache continues to retrieve objects from @@ -946,7 +946,7 @@ NAME: negative_ttl COMMENT: (in minutes) TYPE: time_t LOC: Config.negativeTtl -DEFAULT: 300 +DEFAULT: 5 minutes DOC_START Time-to-Live (TTL) for failed requests. Certain types of failures (such as "connection refused" and "404 Not Found") are @@ -962,13 +962,13 @@ NAME: positive_dns_ttl COMMENT: (in minutes) TYPE: time_t LOC: Config.positiveDnsTtl -DEFAULT: 21600 +DEFAULT: 6 hours DOC_START Time-to-Live (TTL) for positive caching of successful DNS lookups. Default is 6 hours (360 minutes). If you want to minimize the use of Squid's ipcache, set this to 1, not 0. -positive_dns_ttl 360 minutes +positive_dns_ttl 6 hours DOC_END @@ -976,7 +976,7 @@ NAME: negative_dns_ttl COMMENT: (in minutes) TYPE: time_t LOC: Config.negativeDnsTtl -DEFAULT: 300 +DEFAULT: 5 minutes DOC_START Time-to-Live (TTL) for negative caching of failed DNS lookups. @@ -991,7 +991,7 @@ NAME: connect_timeout COMMENT: (in seconds) TYPE: time_t LOC: Config.Timeout.connect -DEFAULT: 120 +DEFAULT: 2 minutes DOC_START Some systems (notably Linux) can not be relied upon to properly time out connect(2) requests. Therefore the squid process @@ -1007,7 +1007,7 @@ NAME: read_timeout COMMENT: (in minutes) TYPE: time_t LOC: Config.Timeout.read -DEFAULT: 900 +DEFAULT: 15 minutes DOC_START The read_timeout is applied on server-side connections. After each successful read(), the timeout will be extended by this @@ -1023,7 +1023,7 @@ NAME: defer_timeout COMMENT: (in minutes) TYPE: time_t LOC: Config.Timeout.defer -DEFAULT: 3600 +DEFAULT: 1 hour DOC_START If your clients are behind slow (e.g. PPP/SLIP) connections, then data may come in from the server-side faster than it can @@ -1033,14 +1033,14 @@ DOC_START to wait while in "deferred read mode." The default is one hour. -defer_timeout 60 minutes +defer_timeout 1 hour DOC_END NAME: request_timeout TYPE: time_t LOC: Config.Timeout.request -DEFAULT: 30 +DEFAULT: 30 seconds DOC_START How long to wait for an HTTP request after connection establishment. For persistent connections, wait this long @@ -1054,7 +1054,7 @@ NAME: client_lifetime COMMENT: (in minutes) TYPE: time_t LOC: Config.Timeout.lifetime -DEFAULT: 86400 +DEFAULT: 1 day DOC_START The maximum amount of time that a client (browser) is allowed to remain connected to the cache process. This protects the Cache @@ -1079,7 +1079,7 @@ NAME: shutdown_lifetime COMMENT: (in seconds) TYPE: time_t LOC: Config.shutdownLifetime -DEFAULT: 30 +DEFAULT: 30 seconds DOC_START When SIGTERM or SIGHUP is received, the cache is put into "shutdown pending" mode until all active sockets are closed. @@ -1306,14 +1306,14 @@ DOC_END NAME: announce_period TYPE: time_t LOC: Config.Announce.period -DEFAULT: 86400 +DEFAULT: 1 day DOC_START This is how frequently to send cache announcements. The default is `0' which disables sending the announcement messages. To enable announcing your cache, just uncomment the line below. -announce_period 24 hours +announce_period 1 day DOC_END @@ -1783,7 +1783,7 @@ DOC_END NAME: netdb_ping_period TYPE: time_t LOC: Config.Netdb.period -DEFAULT: 300 +DEFAULT: 5 minutes DOC_START The minimum period for measuring a site. There will be at least this much delay between successive pings to the same diff --git a/src/debug.cc b/src/debug.cc index f0b5e431ab..3e4eadb1d5 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1,5 +1,5 @@ /* - * $Id: debug.cc,v 1.47 1997/07/14 05:57:54 wessels Exp $ + * $Id: debug.cc,v 1.48 1997/07/14 23:44:58 wessels Exp $ * * DEBUG: section 0 Debug Routines * AUTHOR: Harvest Derived @@ -151,7 +151,7 @@ _db_print(va_alist) vfprintf(debug_log, f, args); if (unbuffered_logs) fflush(debug_log); - if (opt_debug_stderr) + if (opt_debug_stderr && debug_log != stderr) vfprintf(stderr, f, args); va_end(args); } diff --git a/src/ftp.cc b/src/ftp.cc index ce518cf500..d5cdcead68 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.130 1997/07/14 21:11:02 wessels Exp $ + * $Id: ftp.cc,v 1.131 1997/07/14 23:44:59 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -875,21 +875,26 @@ static void ftpConnectDone(int fd, int status, void *data) { FtpStateData *ftpState = data; - debug(9, 3) ("ftpConnectDone\n"); - if (status == COMM_ERROR) { + request_t *request = ftpState->request; + debug(9, 3) ("ftpConnectDone, status = %d\n", status); + if (status == COMM_ERR_DNS) { + debug(9, 4) ("ftpConnectDone: Unknown host: %s\n", request->host); + storeAbort(ftpState->entry, ERR_DNS_FAIL, dns_error_message, 0); + comm_close(fd); + } else if (status != COMM_OK) { storeAbort(ftpState->entry, ERR_CONNECT_FAIL, xstrerror(), 0); comm_close(fd); - return; + } else { + ftpState->state = BEGIN; + ftpState->ctrl.buf = get_free_4k_page(); + ftpState->ctrl.freefunc = put_free_4k_page; + ftpState->ctrl.size = 4096; + ftpState->ctrl.offset = 0; + ftpState->data.buf = xmalloc(SQUID_TCP_SO_RCVBUF); + ftpState->data.size = SQUID_TCP_SO_RCVBUF; + ftpState->data.freefunc = xfree; + commSetSelect(fd, COMM_SELECT_READ, ftpReadControlReply, ftpState, 0); } - ftpState->state = BEGIN; - ftpState->ctrl.buf = get_free_4k_page(); - ftpState->ctrl.freefunc = put_free_4k_page; - ftpState->ctrl.size = 4096; - ftpState->ctrl.offset = 0; - ftpState->data.buf = xmalloc(SQUID_TCP_SO_RCVBUF); - ftpState->data.size = SQUID_TCP_SO_RCVBUF; - ftpState->data.freefunc = xfree; - commSetSelect(fd, COMM_SELECT_READ, ftpReadControlReply, ftpState, 0); } /* ====================================================================== */ @@ -1440,9 +1445,11 @@ ftpAppendSuccessHeader(FtpStateData * ftpState) char *filename = NULL; char *t = NULL; StoreEntry *e = ftpState->entry; - struct _http_reply *reply = e->mem_obj->reply; + http_reply *reply = e->mem_obj->reply; + debug(0,0)("ftpAppendSuccessHeader: %s\n", ftpState->entry->url); if (EBIT_TEST(ftpState->flags, FTP_HTTP_HEADER_SENT)) return; + EBIT_SET(ftpState->flags, FTP_HTTP_HEADER_SENT); assert(e->mem_obj->e_current_len == 0); filename = (t = strrchr(urlpath, '/')) ? t + 1 : urlpath; if (EBIT_TEST(ftpState->flags, FTP_ISDIR)) { @@ -1474,7 +1481,6 @@ ftpAppendSuccessHeader(FtpStateData * ftpState) } storeAppendPrintf(e, "\r\n"); storeTimestampsSet(e); - assert(e->flag & KEY_PRIVATE); storeSetPublicKey(e); } diff --git a/src/globals.h b/src/globals.h index a5ac2e61f8..174ef1febe 100644 --- a/src/globals.h +++ b/src/globals.h @@ -47,7 +47,7 @@ extern int do_mallinfo; extern int do_reuse; /* 1 */ extern int hash_links_allocated; extern int icmp_sock; -extern int neighbors_do_private_keys; +extern int neighbors_do_private_keys; /* 1 */ extern int opt_accel_uses_host; /* 0 */ extern int opt_catch_signals; /* 1 */ extern int opt_debug_stderr; /* 0 */ @@ -55,7 +55,6 @@ extern int opt_dns_tests; /* 1 */ extern int opt_foreground_rebuild; /* 0 */ extern int opt_forwarded_for; /* 1 */ extern int opt_mem_pools; /* 1 */ -extern int opt_no_ipcache; /* 0 */ extern int opt_reload_hit_only; /* 0 */ extern int opt_syslog_enable; /* 0 */ extern int opt_udp_hit_obj; /* 0 */ diff --git a/src/gopher.cc b/src/gopher.cc index 043257d88e..ca315232e0 100644 --- a/src/gopher.cc +++ b/src/gopher.cc @@ -1,5 +1,5 @@ /* - * $Id: gopher.cc,v 1.86 1997/06/19 22:51:50 wessels Exp $ + * $Id: gopher.cc,v 1.87 1997/07/14 23:45:00 wessels Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -913,18 +913,17 @@ static void gopherConnectDone(int fd, int status, void *data) { GopherStateData *gopherState = data; - if (status == COMM_ERROR) { + request_t *request = gopherState->request; + if (status == COMM_ERR_DNS) { + debug(10, 4) ("gopherConnectDone: Unknown host: %s\n", request->host); + storeAbort(gopherState->entry, ERR_DNS_FAIL, dns_error_message, 0); + comm_close(fd); + } else if (status != COMM_OK) { storeAbort(gopherState->entry, ERR_CONNECT_FAIL, xstrerror(), 0); comm_close(fd); - return; + } else { + commSetSelect(fd, COMM_SELECT_WRITE, gopherSendRequest, gopherState, 0); } - /* Install connection complete handler. */ - if (opt_no_ipcache) - ipcacheInvalidate(gopherState->host); - commSetSelect(fd, - COMM_SELECT_WRITE, - gopherSendRequest, - gopherState, 0); } diff --git a/src/http.cc b/src/http.cc index dbc869bcd3..4db89fde8e 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,5 +1,5 @@ /* - * $Id: http.cc,v 1.176 1997/07/02 22:42:55 wessels Exp $ + * $Id: http.cc,v 1.177 1997/07/14 23:45:01 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -924,8 +924,6 @@ httpConnectDone(int fd, int status, void *data) peerCheckConnectStart(httpState->neighbor); comm_close(fd); } else { - if (opt_no_ipcache) - ipcacheInvalidate(request->host); fd_note(fd, entry->url); commSetSelect(fd, COMM_SELECT_WRITE, httpSendRequest, httpState, 0); } diff --git a/src/ident.cc b/src/ident.cc index 94372066e1..2cf21b7522 100644 --- a/src/ident.cc +++ b/src/ident.cc @@ -1,5 +1,5 @@ /* - * $Id: ident.cc,v 1.30 1997/06/04 06:16:00 wessels Exp $ + * $Id: ident.cc,v 1.31 1997/07/14 23:45:01 wessels Exp $ * * DEBUG: section 30 Ident (RFC 931) * AUTHOR: Duane Wessels @@ -79,7 +79,7 @@ identConnectDone(int fd, int status, void *data) { ConnStateData *connState = data; LOCAL_ARRAY(char, reqbuf, BUFSIZ); - if (status == COMM_ERROR) { + if (status != COMM_OK) { comm_close(fd); identCallback(connState); return; diff --git a/src/main.cc b/src/main.cc index a7bccc44b4..6d222d46c9 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,5 @@ /* - * $Id: main.cc,v 1.160 1997/07/14 19:31:40 wessels Exp $ + * $Id: main.cc,v 1.161 1997/07/14 23:45:02 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -137,7 +137,6 @@ usage(void) " -f file Use given config-file instead of\n" " %s\n" " -h Print help message.\n" - " -i Disable IP caching.\n" " -k reconfigure|rotate|shutdown|interrupt|kill|debug|check\n" " Send signal to running copy and exit.\n" " -s Enable logging to syslog.\n" @@ -161,7 +160,7 @@ mainParseOptions(int argc, char *argv[]) extern char *optarg; int c; - while ((c = getopt(argc, argv, "CDFRVYXa:bdf:hik:m:su:vz?")) != -1) { + while ((c = getopt(argc, argv, "CDFRVYXa:bdf:hk:m:su:vz?")) != -1) { switch (c) { case 'C': opt_catch_signals = 0; @@ -201,9 +200,6 @@ mainParseOptions(int argc, char *argv[]) case 'h': usage(); break; - case 'i': - opt_no_ipcache = 1; - break; case 'k': if ((int) strlen(optarg) < 1) usage(); diff --git a/src/squid.h b/src/squid.h index 0ee9aec83c..129cea7455 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.127 1997/07/07 05:29:53 wessels Exp $ + * $Id: squid.h,v 1.128 1997/07/14 23:45:03 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -271,62 +271,6 @@ typedef unsigned long u_num32; #include "snprintf.h" #endif -extern void serverConnectionsClose _PARAMS((void)); -extern void shut_down _PARAMS((int)); - - -extern time_t squid_starttime; /* main.c */ -extern int do_reuse; /* main.c */ -extern int HttpSockets[]; /* main.c */ -extern int NHttpSockets; /* main.c */ -extern int theInIcpConnection; /* main.c */ -extern int theOutIcpConnection; /* main.c */ -extern int vizSock; -extern volatile int shutdown_pending; /* main.c */ -extern volatile int reconfigure_pending; /* main.c */ -extern int opt_reload_hit_only; /* main.c */ -extern int opt_dns_tests; /* main.c */ -extern int opt_foreground_rebuild; /* main.c */ -extern int opt_zap_disk_store; /* main.c */ -extern int opt_syslog_enable; /* main.c */ -extern int opt_catch_signals; /* main.c */ -extern int opt_no_ipcache; /* main.c */ -extern int vhost_mode; /* main.c */ -extern int Squid_MaxFD; /* main.c */ -extern int Biggest_FD; /* main.c */ -extern int select_loops; /* main.c */ -extern const char *const version_string; /* main.c */ -extern const char *const appname; /* main.c */ -extern struct in_addr local_addr; /* main.c */ -extern struct in_addr theOutICPAddr; /* main.c */ -extern const char *const localhost; -extern struct in_addr no_addr; /* main.c */ -extern struct in_addr any_addr; /* main.c */ -extern int opt_udp_hit_obj; /* main.c */ -extern int opt_mem_pools; /* main.c */ -extern int opt_forwarded_for; /* main.c */ -extern int opt_accel_uses_host; /* main.c */ -extern int configured_once; /* main.c */ -extern char ThisCache[]; /* main.c */ - -/* Prototypes and definitions which don't really deserve a separate - * include file */ - -#define CONNECT_PORT 443 - -extern void start_announce _PARAMS((void *unused)); -extern void sslStart _PARAMS((int fd, const char *, request_t *, int *sz)); -extern void waisStart _PARAMS((request_t *, StoreEntry *)); -extern void storeDirClean _PARAMS((void *unused)); -extern void passStart _PARAMS((int, const char *, request_t *, int *)); -extern void identStart _PARAMS((int, ConnStateData *, IDCB * callback)); -extern int httpAnonAllowed _PARAMS((const char *line)); -extern int httpAnonDenied _PARAMS((const char *line)); - -extern const char *const dash_str; -extern const char *const null_string; -extern const char *const w_space; - #define OR(A,B) (A ? A : B) #endif /* SQUID_H */ diff --git a/src/ssl.cc b/src/ssl.cc index 03685b5a44..600f01e6c7 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.55 1997/06/18 01:43:45 wessels Exp $ + * $Id: ssl.cc,v 1.56 1997/07/14 23:45:04 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -348,8 +348,6 @@ sslConnectDone(int fd, int status, void *data) xfree); return; } - if (opt_no_ipcache) - ipcacheInvalidate(sslState->host); if (sslState->proxying) sslProxyConnected(sslState->server.fd, sslState); else diff --git a/src/store.cc b/src/store.cc index 6f6dd0d3e1..282c8fd1d6 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.268 1997/07/14 21:11:04 wessels Exp $ + * $Id: store.cc,v 1.269 1997/07/14 23:45:06 wessels Exp $ * * DEBUG: section 20 Storeage Manager * AUTHOR: Harvest Derived @@ -376,10 +376,7 @@ static void destroy_StoreEntry(StoreEntry * e) { debug(20, 3) ("destroy_StoreEntry: destroying %p\n", e); - if (!e) { - debug_trap("destroy_StoreEntry: NULL Entry"); - return; - } + assert(e != NULL); if (e->mem_obj) destroy_MemObject(e->mem_obj); if (e->url) { @@ -443,10 +440,7 @@ static void storeHashMemDelete(StoreEntry * e) { hash_link *hptr = hash_lookup(in_mem_table, e->key); - if (hptr == NULL) { - debug_trap("storeHashMemDelete: key not found"); - return; - } + assert(hptr != NULL); hash_delete_link(in_mem_table, hptr); meta_data.hot_vm--; } @@ -476,10 +470,8 @@ storeHashDelete(StoreEntry * e) static void storeSetMemStatus(StoreEntry * e, mem_status_t status) { - if (e->key == NULL) { - debug_trap("storeSetMemStatus: NULL key"); - return; - } else if (status != IN_MEMORY && e->mem_status == IN_MEMORY) + assert(e->key != NULL); + if (status != IN_MEMORY && e->mem_status == IN_MEMORY) storeHashMemDelete(e); else if (status == IN_MEMORY && e->mem_status != IN_MEMORY) storeHashMemInsert(e); @@ -571,8 +563,7 @@ storeUnlockObject(StoreEntry * e) assert(!BIT_TEST(e->flag, ENTRY_DISPATCHED)); BIT_SET(e->flag, RELEASE_REQUEST); } - if (storePendingNClients(e) > 0) - debug_trap("storeUnlockObject: unlocked entry with pending clients\n"); + assert(storePendingNClients(e) == 0); if (BIT_TEST(e->flag, RELEASE_REQUEST)) { storeRelease(e); } else if (BIT_TEST(e->flag, ABORT_MSG_PENDING)) { @@ -660,7 +651,7 @@ storeGeneratePublicKey(const char *url, method_t method) /* NOTREACHED */ break; default: - debug_trap("storeGeneratePublicKey: Unsupported request method"); + fatal_dump("storeGeneratePublicKey: Unsupported request method"); break; } return NULL; @@ -669,15 +660,11 @@ storeGeneratePublicKey(const char *url, method_t method) static void storeSetPrivateKey(StoreEntry * e) { - hash_link *table_entry = NULL; const char *newkey = NULL; if (e->key && BIT_TEST(e->flag, KEY_PRIVATE)) return; /* is already private */ newkey = storeGeneratePrivateKey(e->url, e->method, 0); - if ((table_entry = hash_lookup(store_table, newkey))) { - debug_trap("storeSetPrivateKey: duplicate private key"); - return; - } + assert(hash_lookup(store_table, newkey) == NULL); if (e->key) storeHashDelete(e); if (e->key && !BIT_TEST(e->flag, KEY_URL)) @@ -702,12 +689,11 @@ storeSetPublicKey(StoreEntry * e) newkey = storeGeneratePublicKey(e->url, e->method); while ((table_entry = hash_lookup(store_table, newkey))) { - debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", newkey); + debug(20, 1) ("storeSetPublicKey: Making old '%s' private.\n", newkey); e2 = (StoreEntry *) table_entry; storeSetPrivateKey(e2); storeRelease(e2); - if (loop_detect++ == 10) - fatal_dump("storeSetPublicKey() is looping!!"); + assert(++loop_detect < 10); newkey = storeGeneratePublicKey(e->url, e->method); } if (e->key) @@ -882,10 +868,7 @@ InvokeHandlers(StoreEntry * e) STCB *callback = NULL; struct _store_client *sc; ssize_t size; - if (mem->clients == NULL && mem->nclients) { - debug_trap("InvokeHandlers: NULL mem->clients"); - return; - } + assert(mem->clients != NULL || mem->nclients == 0); /* walk the entire list looking for valid callbacks */ for (i = 0; i < mem->nclients; i++) { sc = &mem->clients[i]; @@ -1011,8 +994,7 @@ storeSwapInHandle(int u1, const char *buf, int len, int flag, void *data) e); return; } - if (mem->e_current_len > e->object_len) - debug_trap("storeSwapInHandle: Too much data read!"); + assert(mem->e_current_len <= e->object_len); /* complete swapping in */ storeSetMemStatus(e, IN_MEMORY); put_free_8k_page(mem->e_swap_buf); @@ -1020,14 +1002,7 @@ storeSwapInHandle(int u1, const char *buf, int len, int flag, void *data) storeLog(STORE_LOG_SWAPIN, e); debug(20, 5) ("storeSwapInHandle: SwapIn complete: '%s' from %s.\n", e->url, storeSwapFullPath(e->swap_file_number, NULL)); - if (mem->e_current_len != e->object_len) { - debug_trap("storeSwapInHandle: Object size mismatch"); - debug(20, 0) (" --> '%s'\n", e->url); - debug(20, 0) (" --> Expecting %d bytes from file: %s\n", e->object_len, - storeSwapFullPath(e->swap_file_number, NULL)); - debug(20, 0) (" --> Only read %d bytes\n", - mem->e_current_len); - } + assert(mem->e_current_len == e->object_len); e->lock_count++; /* lock while calling handler */ InvokeHandlers(e); /* once more after mem_status state change */ e->lock_count--; @@ -1756,7 +1731,7 @@ storeGetMemSpace(int size) int n_released = 0; int n_locked = 0; int i; - static time_t last_warning = 0; + static int last_warning = 0; static time_t last_check = 0; int pages_needed; @@ -1810,16 +1785,16 @@ storeGetMemSpace(int size) /* These will be neg-cached objects */ n_released += storeRelease(e); } else { - debug_trap("storeGetMemSpace: Bad Entry in LRU list"); + fatal_dump("storeGetMemSpace: Bad Entry in LRU list"); } } i = 3; if (sm_stats.n_pages_in_use > store_pages_max) { - if (squid_curtime - last_warning > 600) { + if (sm_stats.n_pages_in_use > last_warning * 1.05) { debug(20, 0) ("WARNING: Exceeded 'cache_mem' size (%dK > %dK)\n", sm_stats.n_pages_in_use * 4, store_pages_max * 4); - last_warning = squid_curtime; + last_warning = sm_stats.n_pages_in_use; debug(20, 0) ("Perhaps you should increase cache_mem?\n"); i = 0; } @@ -2448,10 +2423,8 @@ storeWriteCleanLogs(void) continue; if (BIT_TEST(e->flag, KEY_PRIVATE)) continue; - if ((dirn = storeDirNumber(e->swap_file_number)) >= Config.cacheSwap.n_configured) { - debug_trap("storeWriteCleanLogss: dirn out of range"); - continue; - } + dirn = storeDirNumber(e->swap_file_number); + assert(dirn < Config.cacheSwap.n_configured); if (fd[dirn] < 0) continue; sprintf(line, "%08x %08x %08x %08x %9d %s\n", diff --git a/src/tools.cc b/src/tools.cc index d4eb6745d0..e3b06ad8d2 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.113 1997/07/14 05:57:55 wessels Exp $ + * $Id: tools.cc,v 1.114 1997/07/14 23:45:07 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -383,7 +383,7 @@ fatal_common(const char *message) syslog(LOG_ALERT, "%s", message); #endif fprintf(debug_log, "FATAL: %s\n", message); - if (opt_debug_stderr) + if (opt_debug_stderr && debug_log != stderr) fprintf(stderr, "FATAL: %s\n", message); fprintf(debug_log, "Squid Cache (Version %s): Terminated abnormally.\n", version_string); diff --git a/src/tunnel.cc b/src/tunnel.cc index f44d0e9ca9..528d8f2dd9 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.55 1997/06/18 01:43:45 wessels Exp $ + * $Id: tunnel.cc,v 1.56 1997/07/14 23:45:04 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -348,8 +348,6 @@ sslConnectDone(int fd, int status, void *data) xfree); return; } - if (opt_no_ipcache) - ipcacheInvalidate(sslState->host); if (sslState->proxying) sslProxyConnected(sslState->server.fd, sslState); else diff --git a/src/wais.cc b/src/wais.cc index 3388d458c1..e46423e834 100644 --- a/src/wais.cc +++ b/src/wais.cc @@ -1,6 +1,6 @@ /* - * $Id: wais.cc,v 1.78 1997/06/19 22:51:57 wessels Exp $ + * $Id: wais.cc,v 1.79 1997/07/14 23:45:08 wessels Exp $ * * DEBUG: section 24 WAIS Relay * AUTHOR: Harvest Derived @@ -344,18 +344,12 @@ waisConnectDone(int fd, int status, void *data) if (status == COMM_ERR_DNS) { storeAbort(waisState->entry, ERR_DNS_FAIL, dns_error_message, 0); comm_close(fd); - return; } else if (status != COMM_OK) { storeAbort(waisState->entry, ERR_CONNECT_FAIL, xstrerror(), 0); comm_close(fd); - return; + } else { + commSetSelect(fd, COMM_SELECT_WRITE, waisSendRequest, waisState, 0); } - if (opt_no_ipcache) - ipcacheInvalidate(waisState->relayhost); - commSetSelect(fd, - COMM_SELECT_WRITE, - waisSendRequest, - waisState, 0); } static void