]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- warning if no units present for times or byte sizes
authorwessels <>
Tue, 15 Jul 1997 05:44:57 +0000 (05:44 +0000)
committerwessels <>
Tue, 15 Jul 1997 05:44:57 +0000 (05:44 +0000)
- 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

15 files changed:
src/cache_cf.cc
src/cf.data.pre
src/debug.cc
src/ftp.cc
src/globals.h
src/gopher.cc
src/http.cc
src/ident.cc
src/main.cc
src/squid.h
src/ssl.cc
src/store.cc
src/tools.cc
src/tunnel.cc
src/wais.cc

index b085f4fae0578d434958f6e6670779dfc197eedd..d76626d280bd7da1763fb07006184c91428172b9 100644 (file)
@@ -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;
 }
 
index 8008eb27eaba84b28ac94716f2686dbbc72f238d..9cb2c9c6cd539d06802a2174a34c1d73a594c683 100644 (file)
@@ -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
index f0b5e431ab8791f63683aad07196b1e71d2e1edc..3e4eadb1d5cdb724105e30475d1ac34ef5f17a5b 100644 (file)
@@ -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);
 }
index ce518cf50092a50144993249f124c55fbee18a21..d5cdcead68b5ca8df80cb2543fac77eaa2075480 100644 (file)
@@ -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);
 }
 
index a5ac2e61f8ded9e5b38e4fe3178c6bfb92b72e6f..174ef1febe2e7413cfe33c1ab1b7895af01e497b 100644 (file)
@@ -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 */
index 043257d88e16f1f69910e938f65aae94449e5219..ca315232e05fe52e29f2b808eae0c3438093e210 100644 (file)
@@ -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);
 }
 
 
index dbc869bcd372e9e6c8db6c8843e46689abeaaf18..4db89fde8e5bd031d16e189ca7bee8269fb613ff 100644 (file)
@@ -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);
     }
index 94372066e17270887d8f31fc641a4c966a7e4968..2cf21b7522f8f115b674f7b7294f641c0b91da78 100644 (file)
@@ -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;
index a7bccc44b410ad56e139d1dc9518b25baaf2a276..6d222d46c933afa583e28df36ebe8ac4939d84cb 100644 (file)
@@ -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();
index 0ee9aec83ca6b02e2fb2a7e295df57dd4f3199f8..129cea745523ba92482092b3b578a5dba52c7ff4 100644 (file)
@@ -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 */
index 03685b5a4486e6745a776d8273856d4a50eeddd3..600f01e6c7fbe609fe9c98720231af7951a8c223 100644 (file)
@@ -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
index 6f6dd0d3e1b8cba81068856e93038cc63cddcc3b..282c8fd1d65320364157d1f7e2b703e316b21e39 100644 (file)
@@ -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",
index d4eb6745d05b5d82e96f5577fdf1bdc686bff8a9..e3b06ad8d2f63a30759fb5c04d7be4ab1f5f30c5 100644 (file)
@@ -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);
index f44d0e9ca9b304c6ffbcfa2b4ca0b2a9d80537ea..528d8f2dd925844538bedeaee82df38f6be5f638 100644 (file)
@@ -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
index 3388d458c107197bd788c8c203629625222a24bb..e46423e83423e80eaad533c085566d8ab2cf0812 100644 (file)
@@ -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