From: Benno Rice Date: Mon, 22 Sep 2008 00:53:13 +0000 (+1000) Subject: Address comments from Alex and Amos. X-Git-Tag: SQUID_3_1_0_1~49^2~9^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bd06eff35f342c876c54400810e677bc3c38841;p=thirdparty%2Fsquid.git Address comments from Alex and Amos. - 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. --- diff --git a/src/htcp.cc b/src/htcp.cc index f09f94418f..801b6c4e04 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -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; } diff --git a/src/neighbors.cc b/src/neighbors.cc index d6d07eee04..c01498c832 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -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); } }