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)
{
}
}
+/*
+ * 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)
{
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)
{
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;
}
xfree(stuff.S.uri);
}
if (!pktlen) {
- debug(31, 1) ("htcpClear: htcpBuildPacket() failed\n");
+ debugs(31, 1, "htcpClear: htcpBuildPacket() failed");
return;
}
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;
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);
}
}