]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
DW:
authorwessels <>
Tue, 10 Oct 2000 08:10:42 +0000 (08:10 +0000)
committerwessels <>
Tue, 10 Oct 2000 08:10:42 +0000 (08:10 +0000)
 - Changed "WARNING: swapin MD5 mismatch" logging so that it is printed
   only on powers of ten, just like "ignored XX replies non-peer"
   messages in neighbors.c.

src/neighbors.cc
src/protos.h
src/store_client.cc
src/tools.cc

index a98e7b84d5cdc838076696f21d3aeb9d34378b35..7cca72e6b048a7dcb84e09c857551b46a4e707f4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: neighbors.cc,v 1.285 2000/10/04 01:13:25 wessels Exp $
+ * $Id: neighbors.cc,v 1.286 2000/10/10 02:10:42 wessels Exp $
  *
  * DEBUG: section 15    Neighbor Routines
  * AUTHOR: Harvest Derived
@@ -701,7 +701,6 @@ static void
 neighborIgnoreNonPeer(const struct sockaddr_in *from, icp_opcode opcode)
 {
     peer *np;
-    double x;
     for (np = non_peers; np; np = np->next) {
        if (np->in_addr.sin_addr.s_addr != from->sin_addr.s_addr)
            continue;
@@ -719,13 +718,10 @@ neighborIgnoreNonPeer(const struct sockaddr_in *from, icp_opcode opcode)
        np->next = non_peers;
        non_peers = np;
     }
-    np->stats.ignored_replies++;
     np->icp.counts[opcode]++;
-    x = log(np->stats.ignored_replies) / log(10.0);
-    if (0.0 != x - (double) (int) x)
-       return;
-    debug(15, 1) ("WARNING: Ignored %d replies from non-peer %s\n",
-       np->stats.ignored_replies, np->host);
+    if (isPowTen(++np->stats.ignored_replies))
+       debug(15, 1) ("WARNING: Ignored %d replies from non-peer %s\n",
+           np->stats.ignored_replies, np->host);
 }
 
 /* ignoreMulticastReply
index 58a20fbb5c7acd3f0e1da5d65d73005b973e0aee..df3449075724a9dbe492d2280671c16946fba8b6 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.380 2000/10/04 15:32:13 wessels Exp $
+ * $Id: protos.h,v 1.381 2000/10/10 02:10:42 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -1072,6 +1072,7 @@ extern int stringHasCntl(const char *);
 extern void linklistPush(link_list **, void *);
 extern void *linklistShift(link_list **);
 extern int xrename(const char *from, const char *to);
+extern int isPowTen(int);
 
 #if USE_HTCP
 extern void htcpInit(void);
index 4edad8e8a9e93212722eaf4b35d201d3b2f6f521..3336913c587fb0aeedf5c751628813567b43b75f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_client.cc,v 1.96 2000/10/09 18:37:10 wessels Exp $
+ * $Id: store_client.cc,v 1.97 2000/10/10 02:10:43 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Client-Side Interface
  * AUTHOR: Duane Wessels
@@ -371,6 +371,7 @@ storeClientReadBody(void *data, const char *buf, ssize_t len)
 static void
 storeClientReadHeader(void *data, const char *buf, ssize_t len)
 {
+    static int md5_mismatches = 0;
     store_client *sc = data;
     StoreEntry *e = sc->entry;
     MemObject *mem = e->mem_obj;
@@ -410,9 +411,12 @@ storeClientReadHeader(void *data, const char *buf, ssize_t len)
            assert(t->length == MD5_DIGEST_CHARS);
            if (!EBIT_TEST(e->flags, KEY_PRIVATE) &&
                memcmp(t->value, e->key, MD5_DIGEST_CHARS)) {
-               debug(20, 1) ("WARNING: swapin MD5 mismatch\n");
-               debug(20, 1) ("\t%s\n", storeKeyText(t->value));
-               debug(20, 1) ("\t%s\n", storeKeyText(e->key));
+               debug(20, 2) ("storeClientReadHeader: swapin MD5 mismatch\n");
+               debug(20, 2) ("\t%s\n", storeKeyText(t->value));
+               debug(20, 2) ("\t%s\n", storeKeyText(e->key));
+               if (isPowTen(++md5_mismatches))
+                   debug(20, 1) ("WARNING: %d swapin MD5 mismatches\n",
+                       md5_mismatches);
                swap_object_ok = 0;
            }
            break;
index 72a664795315e906fe09b5bfdcbadbd6b7e5a433..b25f2a225eecfe9ed9a379ca763f2ef98a65687a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: tools.cc,v 1.195 2000/09/16 21:47:46 hno Exp $
+ * $Id: tools.cc,v 1.196 2000/10/10 02:10:43 wessels Exp $
  *
  * DEBUG: section 21    Misc Functions
  * AUTHOR: Harvest Derived
@@ -908,3 +908,17 @@ stringHasCntl(const char *s)
     }
     return 0;
 }
+
+/*
+ * isPowTen returns true if its argument is an integer power of
+ * 10.  Its used for logging of certain error messages that can
+ * occur often, but that we don't want to fill cache.log with.
+ */
+int
+isPowTen(int count)
+{
+    double x = log(count) / log(10.0);
+    if (0.0 != x - (double) (int) x)
+       return 0;
+    return 1;
+}