]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Incremental merge from rproxy
authorhno <>
Sun, 16 Feb 2003 01:13:35 +0000 (01:13 +0000)
committerhno <>
Sun, 16 Feb 2003 01:13:35 +0000 (01:13 +0000)
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.

src/cf.data.pre
src/main.cc
src/neighbors.cc
src/protos.h

index 6b9fa38f4082222d48af4e6f50791b29f8f33e93..be9e622e4480ba68fb61149c3590e8bb69541ff0 100644 (file)
@@ -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
index 9e6b499f2019543fbf91d8999116f850863f39df..c08637d7516e01a53aa09f8e0901640959bf7ce1 100644 (file)
@@ -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)
index 436fb8cd2711476c7c841dc7b62ca4f6281d079a..64f73487500b1fac0989c57e565244be7f63a131 100644 (file)
@@ -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)));
index 35fa1bc575d168f1e264670b7aa80824310a1eda..145c4a81a982786afb3de5a98e01ff040cde9301 100644 (file)
@@ -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);