From e8d185d28de2108ca9d5368435f56da45971943d Mon Sep 17 00:00:00 2001 From: wessels <> Date: Sat, 28 Mar 1998 13:26:42 +0000 Subject: [PATCH] change HTCP vs ICP configuration to be a cache_peer flag instead of separate port members --- src/cache_cf.cc | 17 +++++------------ src/enums.h | 3 ++- src/neighbors.cc | 6 ++++-- src/structs.h | 3 --- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index f475e59f4b..9c071ab574 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.265 1998/03/28 05:26:08 wessels Exp $ + * $Id: cache_cf.cc,v 1.266 1998/03/28 06:26:42 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -653,7 +653,6 @@ parse_peer(peer ** head) int i; ushortlist *u; const char *me = null_string; /* XXX */ - char *t; p = xcalloc(1, sizeof(peer)); p->http_port = CACHE_HTTP_PORT; p->icp_port = CACHE_ICP_PORT; @@ -667,16 +666,8 @@ parse_peer(peer ** head) p->type = parseNeighborType(token); GetInteger(i); p->http_port = (u_short) i; - if ((token = strtok(NULL, w_space)) == NULL) - self_destruct(); - if (NULL == (t = strchr(token, '/'))) - p->icp_port = atoi(token); - else if (0 == strcmp(t, "/icp")) - p->icp_port = atoi(token); - else if (0 == strcmp(t, "/htcp")) - p->htcp_port = atoi(token); - else - self_destruct(); + GetInteger(i); + p->icp_port = (u_short) i; if (strcmp(p->host, me) == 0) { for (u = Config.Port.http; u; u = u->next) { if (p->http_port != u->i) @@ -707,6 +698,8 @@ parse_peer(peer ** head) EBIT_SET(p->options, NEIGHBOR_DEFAULT_PARENT); } else if (!strncasecmp(token, "round-robin", 11)) { EBIT_SET(p->options, NEIGHBOR_ROUNDROBIN); + } else if (!strncasecmp(token, "htcp", 4)) { + EBIT_SET(p->options, NEIGHBOR_HTCP); } else { debug(3, 0) ("parse_peer: token='%s'\n", token); self_destruct(); diff --git a/src/enums.h b/src/enums.h index 23d48ad69a..bb77b03d83 100644 --- a/src/enums.h +++ b/src/enums.h @@ -437,7 +437,8 @@ enum { NEIGHBOR_DEFAULT_PARENT, NEIGHBOR_ROUNDROBIN, NEIGHBOR_MCAST_RESPONDER, - NEIGHBOR_CLOSEST_ONLY + NEIGHBOR_CLOSEST_ONLY, + NEIGHBOR_HTCP }; typedef enum { diff --git a/src/neighbors.cc b/src/neighbors.cc index 9a6b9a5c10..dee2775855 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.184 1998/03/28 05:28:54 wessels Exp $ + * $Id: neighbors.cc,v 1.185 1998/03/28 06:26:44 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -442,7 +442,7 @@ neighborsUdpPing(request_t * request, debug(15, 3) ("neighborsUdpPing: key = '%s'\n", storeKeyText(entry->key)); debug(15, 3) ("neighborsUdpPing: reqnum = %d\n", reqnum); - if (p->htcp_port > 0) { + if (EBIT_TEST(p->options, NEIGHBOR_HTCP)) { debug(15, 0)("neighborsUdpPing: sending HTCP query\n"); htcpQuery(entry, request, p); } else if (p->icp_port == echo_port) { @@ -1005,6 +1005,8 @@ dump_peer_options(StoreEntry * sentry, peer * p) storeAppendPrintf(sentry, " multicast-responder"); if (EBIT_TEST(p->options, NEIGHBOR_CLOSEST_ONLY)) storeAppendPrintf(sentry, " closest-only"); + if (EBIT_TEST(p->options, NEIGHBOR_HTCP)) + storeAppendPrintf(sentry, " htcp"); if (p->mcast.ttl > 0) storeAppendPrintf(sentry, " ttl=%d", p->mcast.ttl); storeAppendPrintf(sentry, "\n"); diff --git a/src/structs.h b/src/structs.h index 5d584d06e3..8c335ee6fa 100644 --- a/src/structs.h +++ b/src/structs.h @@ -775,9 +775,6 @@ struct _peer { int logged_state; /* so we can print dead/revived msgs */ } stats; u_short icp_port; -#if USE_HTCP - u_short htcp_port; -#endif u_short http_port; int icp_version; struct _domain_ping *pinglist; -- 2.47.2