From: hno <> Date: Sun, 16 Feb 2003 01:13:35 +0000 (+0000) Subject: Incremental merge from rproxy X-Git-Tag: SQUID_3_0_PRE1~337 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a86029b90dee73e9076e388d14b3f320532cb4fe;p=thirdparty%2Fsquid.git Incremental merge from rproxy remove the "hack" to have ICP disabled in accelerator only setups even if icp_port is configured. This should be done by setting "icp_port 0", not by the fact that Squid is configured as a reverse proxy. Note: later merges from rproxy will remove the httpd_accel_* directives, making the "accelerator vs proxy" boundary much thinner. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 6b9fa38f40..be9e622e44 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1,6 +1,6 @@ # -# $Id: cf.data.pre,v 1.300 2003/02/15 00:15:51 hno Exp $ +# $Id: cf.data.pre,v 1.301 2003/02/15 18:13:35 hno Exp $ # # # SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -2701,10 +2701,6 @@ DOC_START where it accepted the request as hostname in the URL. If you want virtual port support then specify the port as "0". - - NOTE: enabling httpd_accel_host disables proxy-caching and - ICP. If you want these features enabled also, then set - the 'httpd_accel_with_proxy' option. DOC_END NAME: httpd_accel_single_host diff --git a/src/main.cc b/src/main.cc index 9e6b499f20..c08637d751 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.365 2003/02/06 23:13:00 robertc Exp $ + * $Id: main.cc,v 1.366 2003/02/15 18:13:35 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -362,12 +362,7 @@ mainReconfigure(void) wccpInit(); #endif serverConnectionsOpen(); - if (theOutIcpConnection >= 0) { - if (!Config2.Accel.on || Config.onoff.accel_with_proxy) - neighbors_open(theOutIcpConnection); - else - debug(1, 1) ("ICP port disabled in httpd_accelerator mode\n"); - } + neighbors_init(); storeDirOpenSwapLogs(); mimeInit(Config.mimeTablePathname); writePidFile(); /* write PID file */ @@ -526,12 +521,7 @@ mainInitialize(void) wccpInit(); #endif serverConnectionsOpen(); - if (theOutIcpConnection >= 0) { - if (!Config2.Accel.on || Config.onoff.accel_with_proxy) - neighbors_open(theOutIcpConnection); - else - debug(1, 1) ("ICP port disabled in httpd_accelerator mode\n"); - } + neighbors_init(); if (Config.chroot_dir) no_suid(); if (!configured_once) diff --git a/src/neighbors.cc b/src/neighbors.cc index 436fb8cd27..64f7348750 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,6 +1,6 @@ /* - * $Id: neighbors.cc,v 1.314 2003/02/15 12:42:09 hno Exp $ + * $Id: neighbors.cc,v 1.315 2003/02/15 18:13:36 hno Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -407,7 +407,7 @@ neighborRemove(peer * target) } void -neighbors_open(int fd) +neighbors_init(void) { struct sockaddr_in name; socklen_t len = sizeof(struct sockaddr_in); @@ -415,25 +415,27 @@ neighbors_open(int fd) const char *me = getMyHostname(); peer *thisPeer; peer *next; - memset(&name, '\0', sizeof(struct sockaddr_in)); - if (getsockname(fd, (struct sockaddr *) &name, &len) < 0) - debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len); - for (thisPeer = Config.peers; thisPeer; thisPeer = next) { - sockaddr_in_list *s; - next = thisPeer->next; - if (0 != strcmp(thisPeer->host, me)) - continue; - for (s = Config.Sockaddr.http; s; s = s->next) { - if (thisPeer->http_port != ntohs(s->s.sin_port)) + int fd = theInIcpConnection; + if (fd >= 0) { + memset(&name, '\0', sizeof(struct sockaddr_in)); + if (getsockname(fd, (struct sockaddr *) &name, &len) < 0) + debug(15, 1) ("getsockname(%d,%p,%p) failed.\n", fd, &name, &len); + for (thisPeer = Config.peers; thisPeer; thisPeer = next) { + sockaddr_in_list *s; + next = thisPeer->next; + if (0 != strcmp(thisPeer->host, me)) continue; - debug(15, 1) ("WARNING: Peer looks like this host\n"); - debug(15, 1) (" Ignoring %s %s/%d/%d\n", - neighborTypeStr(thisPeer), thisPeer->host, thisPeer->http_port, - thisPeer->icp.port); - neighborRemove(thisPeer); + for (s = Config.Sockaddr.http; s; s = s->next) { + if (thisPeer->http_port != ntohs(s->s.sin_port)) + continue; + debug(15, 1) ("WARNING: Peer looks like this host\n"); + debug(15, 1) (" Ignoring %s %s/%d/%d\n", + neighborTypeStr(thisPeer), thisPeer->host, thisPeer->http_port, + thisPeer->icp.port); + neighborRemove(thisPeer); + } } } - peerRefreshDNS((void *) 1); if (ICP_INVALID == echo_hdr.opcode) { echo_hdr.opcode = ICP_SECHO; @@ -450,9 +452,11 @@ neighbors_open(int fd) cachemgrRegister("server_list", "Peer Cache Statistics", neighborDumpPeers, 0, 1); - cachemgrRegister("non_peers", - "List of Unknown sites sending ICP messages", - neighborDumpNonPeers, 0, 1); + if (theInIcpConnection >= 0) { + cachemgrRegister("non_peers", + "List of Unknown sites sending ICP messages", + neighborDumpNonPeers, 0, 1); + } } int @@ -1347,39 +1351,46 @@ dump_peers(StoreEntry * sentry, peer * peers) storeAppendPrintf(sentry, "FETCHES : %d\n", e->stats.fetches); storeAppendPrintf(sentry, "OPEN CONNS : %d\n", e->stats.conn_open); storeAppendPrintf(sentry, "AVG RTT : %d msec\n", e->stats.rtt); - storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n", - (int) (squid_curtime - e->stats.last_query)); - storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n", - (int) (squid_curtime - e->stats.last_reply)); - storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent); - storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n", - e->stats.pings_acked, - percent(e->stats.pings_acked, e->stats.pings_sent)); + if (!e->options.no_query) { + storeAppendPrintf(sentry, "LAST QUERY : %8d seconds ago\n", + (int) (squid_curtime - e->stats.last_query)); + if (e->stats.last_reply > 0) + storeAppendPrintf(sentry, "LAST REPLY : %8d seconds ago\n", + (int) (squid_curtime - e->stats.last_reply)); + else + storeAppendPrintf(sentry, "LAST REPLY : none received\n"); + storeAppendPrintf(sentry, "PINGS SENT : %8d\n", e->stats.pings_sent); + storeAppendPrintf(sentry, "PINGS ACKED: %8d %3d%%\n", + e->stats.pings_acked, + percent(e->stats.pings_acked, e->stats.pings_sent)); + } storeAppendPrintf(sentry, "IGNORED : %8d %3d%%\n", e->stats.ignored_replies, percent(e->stats.ignored_replies, e->stats.pings_acked)); - storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n"); + if (!e->options.no_query) { + storeAppendPrintf(sentry, "Histogram of PINGS ACKED:\n"); #if USE_HTCP - if (e->options.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 { + if (e->options.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; - storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n", - icp_opcode_str[op], - e->icp.counts[op], - percent(e->icp.counts[op], e->stats.pings_acked)); - } + for (op = ICP_INVALID; op < ICP_END; ++op) { + if (e->icp.counts[op] == 0) + continue; + storeAppendPrintf(sentry, " %12.12s : %8d %3d%%\n", + icp_opcode_str[op], + e->icp.counts[op], + percent(e->icp.counts[op], e->stats.pings_acked)); + } #if USE_HTCP - } + } #endif + } if (e->stats.last_connect_failure) { storeAppendPrintf(sentry, "Last failed connect() at: %s\n", mkhttpdlogtime(&(e->stats.last_connect_failure))); diff --git a/src/protos.h b/src/protos.h index 35fa1bc575..145c4a81a9 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.465 2003/02/14 13:59:50 robertc Exp $ + * $Id: protos.h,v 1.466 2003/02/15 18:13:36 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -511,7 +511,7 @@ SQUIDCEXTERN int neighborsUdpPing(request_t *, SQUIDCEXTERN void neighborAddAcl(const char *, const char *); SQUIDCEXTERN void neighborsUdpAck(const cache_key *, icp_common_t *, const struct sockaddr_in *); SQUIDCEXTERN void neighborAdd(const char *, const char *, int, int, int, int, int); -SQUIDCEXTERN void neighbors_open(int); +SQUIDCEXTERN void neighbors_init(void); SQUIDCEXTERN peer *peerFindByName(const char *); SQUIDCEXTERN peer *peerFindByNameAndPort(const char *, unsigned short); SQUIDCEXTERN peer *getDefaultParent(request_t * request);