From: wessels <> Date: Thu, 27 Aug 1998 01:53:39 +0000 (+0000) Subject: HTCP progress X-Git-Tag: SQUID_3_0_PRE1~2786 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1994bb24d88bc770a6f568674423a87199681ca8;p=thirdparty%2Fsquid.git HTCP progress --- diff --git a/src/htcp.cc b/src/htcp.cc index f5e7820ab8..d10e011a22 100644 --- a/src/htcp.cc +++ b/src/htcp.cc @@ -1,6 +1,6 @@ /* - * $Id: htcp.cc,v 1.17 1998/08/26 19:08:00 wessels Exp $ + * $Id: htcp.cc,v 1.18 1998/08/26 19:53:39 wessels Exp $ * * DEBUG: section 31 Hypertext Caching Protocol * AUTHOR: Duane Wesssels @@ -782,7 +782,7 @@ htcpRecv(int fd, void *data) int flen = sizeof(struct sockaddr_in); memset(&from, '\0', flen); len = recvfrom(fd, buf, 8192, 0, (struct sockaddr *) &from, &flen); - debug(31, 0) ("htcpRecv: FD %d, %d bytes from %s:%d\n", + debug(31, 1) ("htcpRecv: FD %d, %d bytes from %s:%d\n", fd, len, inet_ntoa(from.sin_addr), ntohs(from.sin_port)); htcpHandle(buf, len, &from); commSetSelect(fd, COMM_SELECT_READ, htcpRecv, NULL, 0); @@ -865,7 +865,6 @@ htcpQuery(StoreEntry * e, request_t * req, peer * p) htcpSend(pkt, (int) pktlen, &p->in_addr); save_key = queried_keys[stuff.msg_id % N_QUERIED_KEYS]; storeKeyCopy(save_key, e->key); - debug(31,1)("htcpQuery: key (%p) %s\n", 30>e->key, storeKeyText(e->key)); debug(31,1)("htcpQuery: key (%p) %s\n", save_key, storeKeyText(save_key)); debug(1,1)("%s:%d\n", __FILE__, __LINE__); xfree(pkt); } diff --git a/src/neighbors.cc b/src/neighbors.cc index 3e41a05f59..32156a2722 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.237 1998/08/26 19:08:55 wessels Exp $ + * $Id: neighbors.cc,v 1.238 1998/08/26 19:53:40 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -377,7 +377,7 @@ neighborsUdpPing(request_t * request, #if USE_HTCP if (EBIT_TEST(p->options, NEIGHBOR_HTCP)) { - debug(15, 0) ("neighborsUdpPing: sending HTCP query\n"); + debug(15, 3) ("neighborsUdpPing: sending HTCP query\n"); htcpQuery(entry, request, p); } else #endif @@ -833,13 +833,17 @@ peerFindByName(const char *name) int neighborUp(const peer * p) { + int rc = 0; if (!p->tcp_up) - return 0; - if (squid_curtime - p->stats.last_query > Config.Timeout.deadPeer) - return 1; - if (p->stats.last_query - p->stats.last_reply >= Config.Timeout.deadPeer) - return 0; - return 1; + rc = 0; + else if (squid_curtime - p->stats.last_query > Config.Timeout.deadPeer) + rc = 1; + else if (p->stats.last_query - p->stats.last_reply >= Config.Timeout.deadPeer) + rc = 0; + else + rc = 1; + debug(1, 1) ("neighborUp: %s is %s\n", p->host, rc ? "UP" : "DOWN"); + return rc; } void @@ -1145,6 +1149,16 @@ dump_peers(StoreEntry * sentry, peer * peers) e->stats.ignored_replies, percent(e->stats.ignored_replies, e->stats.pings_acked)); storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n"); +#if USE_HTCP + if (EBIT_TEST(e->options, NEIGHBOR_HTCP)) { + storeAppendPrintf(sentry, "\tMisses\t%8d %3d%%\n", + e->htcp.counts[0], + percent(e->htcp.counts[0], e->stats.pings_acked)); + storeAppendPrintf(sentry, "\tHits\t%8d %3d%%\n", + e->htcp.counts[1], + percent(e->htcp.counts[1], e->stats.pings_acked)); + } else { +#endif for (op = ICP_INVALID; op < ICP_END; op++) { if (e->icp.counts[op] == 0) continue; @@ -1153,19 +1167,21 @@ dump_peers(StoreEntry * sentry, peer * peers) e->icp.counts[op], percent(e->icp.counts[op], e->stats.pings_acked)); } +#if USE_HTCP +} +#endif if (e->last_fail_time) { storeAppendPrintf(sentry, "Last failed connect() at: %s\n", mkhttpdlogtime(&(e->last_fail_time))); } - if (e->pinglist != NULL) + if (e->pinglist != NULL) { storeAppendPrintf(sentry, "DOMAIN LIST: "); - for (d = e->pinglist; d; d = d->next) { - if (d->do_ping) - storeAppendPrintf(sentry, "%s ", d->domain); - else - storeAppendPrintf(sentry, "!%s ", d->domain); + for (d = e->pinglist; d; d = d->next) { + storeAppendPrintf(sentry, "%s%s ", + d->do_ping ? null_string : "!", d->domain); + } + storeAppendPrintf(sentry, "\n"); } - storeAppendPrintf(sentry, "\n"); storeAppendPrintf(sentry, "keep-alive ratio: %d%%\n", percent(e->stats.n_keepalives_recv, e->stats.n_keepalives_sent)); } diff --git a/src/url.cc b/src/url.cc index 8248cc023f..a5fa027456 100644 --- a/src/url.cc +++ b/src/url.cc @@ -1,6 +1,6 @@ /* - * $Id: url.cc,v 1.107 1998/08/21 03:15:29 wessels Exp $ + * $Id: url.cc,v 1.108 1998/08/26 19:53:41 wessels Exp $ * * DEBUG: section 23 URL Parsing * AUTHOR: Duane Wessels @@ -56,6 +56,9 @@ const char *ProtocolStr[] = "wais", "cache_object", "icp", +#if USE_HTCP + "htcp", +#endif "urn", "whois", "internal",