]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Address comments from Alex and Amos.
authorBenno Rice <benno@squid-cache.org>
Mon, 22 Sep 2008 00:53:13 +0000 (10:53 +1000)
committerBenno Rice <benno@squid-cache.org>
Mon, 22 Sep 2008 00:53:13 +0000 (10:53 +1000)
- Add some comments describing various function purposes.
- Remove some debugging debugs that had crept in.
- Use debugs() in preference to debug()().
- Adjust some debug levels.

src/htcp.cc
src/neighbors.cc

index f09f94418f14012cb516873f809c534285bd0b94..801b6c4e04d27898f6cea40a135302675438089e 100644 (file)
@@ -1306,6 +1306,10 @@ htcpHandleClr(htcpDataHeader * hdr, char *buf, int sz, IPAddress &from)
     htcpFreeSpecifier(s);
 }
 
+/*
+ * Forward a CLR request to all peers who have requested that CLRs be
+ * forwarded to them.
+ */
 static void
 htcpForwardClr(char *buf, int sz)
 {
@@ -1323,6 +1327,14 @@ htcpForwardClr(char *buf, int sz)
     }
 }
 
+/*
+ * Do the first pass of handling an HTCP message.  This used to be two
+ * separate functions, htcpHandle and htcpHandleData.  They were merged to
+ * allow for forwarding HTCP packets easily to other peers if desired.
+ *
+ * This function now works out what type of message we have received and then
+ * hands it off to other functions to break apart message-specific data.
+ */
 static void
 htcpHandle(char *buf, int sz, IPAddress &from)
 {
@@ -1577,6 +1589,9 @@ htcpQuery(StoreEntry * e, HttpRequest * req, peer * p)
     debugs(31, 3, "htcpQuery: key (" << save_key << ") " << storeKeyText(save_key));
 }
 
+/*
+ * Send an HTCP CLR message for a specified item to a given peer.
+ */
 void
 htcpClear(StoreEntry * e, const char *uri, HttpRequest * req, const HttpRequestMethod &method, peer * p, htcp_clr_reason reason)
 {
@@ -1627,7 +1642,6 @@ htcpClear(StoreEntry * e, const char *uri, HttpRequest * req, const HttpRequestM
         hdr.clean();
         packerClean(&pa);
        stuff.S.req_hdrs = mb.buf;
-        debug(31, 1) ("htcpClear: headers: %s\n", stuff.S.req_hdrs);
     } else {
         stuff.S.req_hdrs = NULL;
     }
@@ -1639,7 +1653,7 @@ htcpClear(StoreEntry * e, const char *uri, HttpRequest * req, const HttpRequestM
        xfree(stuff.S.uri);
     }
     if (!pktlen) {
-       debug(31, 1) ("htcpClear: htcpBuildPacket() failed\n");
+       debugs(31, 1, "htcpClear: htcpBuildPacket() failed");
        return;
     }
     
index d6d07eee045c63cd11b041655e494c0fa3f590b7..c01498c8321d192f4f8608314c446bd8b9209f6c 100644 (file)
@@ -1836,13 +1836,15 @@ neighborsHtcpReply(const cache_key * key, htcpReplyData * htcp, const IPAddress
     mem->ping_reply_callback(p, ntype, PROTO_HTCP, htcp, mem->ircb_data);
 }
 
+/*
+ * Send HTCP CLR messages to all peers configured to receive them.
+ */
 void
 neighborsHtcpClear(StoreEntry * e, const char *uri, HttpRequest * req, const HttpRequestMethod &method, htcp_clr_reason reason)
 {
     peer *p;
     char buf[128];
 
-    debug(15, 1) ("neighborsHtcpClear: clear reason: %d\n", reason);
     for (p = Config.peers; p; p = p->next) {
         if (!p->options.htcp) {
             continue;
@@ -1853,7 +1855,7 @@ neighborsHtcpClear(StoreEntry * e, const char *uri, HttpRequest * req, const Htt
         if (p->options.htcp_no_purge_clr && reason == HTCP_CLR_PURGE) {
             continue;
         }
-        debug(15, 1) ("neighborsHtcpClear: sending CLR to %s\n", p->in_addr.ToURL(buf, 128));
+        debugs(15, 3, "neighborsHtcpClear: sending CLR to " << p->in_addr.ToURL(buf, 128));
         htcpClear(e, uri, req, method, p, reason);
     }
 }