From 7b41ec97050c6efc21ae00881771270c9f166812 Mon Sep 17 00:00:00 2001 From: wessels <> Date: Wed, 26 Feb 1997 02:18:18 +0000 Subject: [PATCH] Unified peer selection algorithm --- ChangeLog | 6 +++++- src/Makefile.in | 3 ++- src/neighbors.cc | 10 ++++------ src/squid.h | 3 ++- src/ssl.cc | 22 +++++----------------- src/tunnel.cc | 22 +++++----------------- 6 files changed, 23 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index cbdebff6ee..833e97223f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -Changes to squid-1.1.7 (February @@@, 1997): +Changes to squid-1.2.alpha1 (): + + - Unified peer selection algorithm. + +Changes to squid-1.1.7 (February 25 1997): - Fixed urlParse to leave trailing slashes on FTP URLs. Although stripping the slashes offers a slight hit rate increase, it diff --git a/src/Makefile.in b/src/Makefile.in index 94d515ce93..2bbdbb6b5d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.65 1997/02/20 23:54:13 wessels Exp $ +# $Id: Makefile.in,v 1.66 1997/02/25 19:18:19 wessels Exp $ # # Uncomment and customize the following to suit your needs: # @@ -101,6 +101,7 @@ OBJS = \ net_db.o \ objcache.o \ pass.o \ + peer_select.o \ proto.o \ redirect.o \ refresh.o \ diff --git a/src/neighbors.cc b/src/neighbors.cc index fab1047772..dd092dfa4d 100644 --- a/src/neighbors.cc +++ b/src/neighbors.cc @@ -1,5 +1,5 @@ /* - * $Id: neighbors.cc,v 1.122 1997/02/25 16:09:12 wessels Exp $ + * $Id: neighbors.cc,v 1.123 1997/02/25 19:18:21 wessels Exp $ * * DEBUG: section 15 Neighbor Routines * AUTHOR: Harvest Derived @@ -433,12 +433,10 @@ neighbors_open(int fd) } int -neighborsUdpPing(protodispatch_data * proto) +neighborsUdpPing(request_t *request, StoreEntry *entry) { - request_t *request = proto->request; char *host = request->host; - char *url = proto->url; - StoreEntry *entry = proto->entry; + char *url = entry->url; const ipcache_addrs *ia = NULL; struct sockaddr_in to_addr; peer *e = NULL; @@ -532,7 +530,7 @@ neighborsUdpPing(protodispatch_data * proto) /* only do source_ping if we have neighbors */ if (Peers.n) { - if (!proto->source_ping) { + if (Config.sourcePing) { debug(15, 6, "neighborsUdpPing: Source Ping is disabled.\n"); } else if ((ia = ipcache_gethostbyname(host, IP_BLOCKING_LOOKUP))) { debug(15, 6, "neighborsUdpPing: Source Ping: to %s for '%s'\n", diff --git a/src/squid.h b/src/squid.h index f954bd1276..b169f30cb0 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.95 1997/02/23 09:02:21 wessels Exp $ + * $Id: squid.h,v 1.96 1997/02/25 19:18:24 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -300,6 +300,7 @@ typedef int (*QS) (const void *, const void *); #include "client_db.h" #include "objcache.h" #include "refresh.h" +#include "peer_select.h" #if !HAVE_TEMPNAM #include "tempnam.h" diff --git a/src/ssl.cc b/src/ssl.cc index 11c0ab5087..db3d1099a8 100644 --- a/src/ssl.cc +++ b/src/ssl.cc @@ -1,6 +1,6 @@ /* - * $Id: ssl.cc,v 1.38 1997/02/19 23:53:43 wessels Exp $ + * $Id: ssl.cc,v 1.39 1997/02/25 19:18:24 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -491,23 +491,11 @@ sslSelectNeighbor(int fd, const ipcache_addrs * ia, void *data) request_t *request = sslState->request; peer *e = NULL; peer *g = NULL; - int fw_ip_match = IP_ALLOW; - if (ia && Config.firewall_ip_list) - fw_ip_match = ip_access_check(ia->in_addrs[ia->cur], Config.firewall_ip_list); - if (matchInsideFirewall(request->host)) { + hier_code code; + if (peerSelectDirect(request)) { hierarchyNote(request, HIER_DIRECT, 0, request->host); - } else if (fw_ip_match == IP_DENY) { - hierarchyNote(request, HIER_FIREWALL_IP_DIRECT, 0, request->host); - } else if ((e = Config.sslProxy)) { - hierarchyNote(request, HIER_SSL_PARENT, 0, e->host); - } else if ((e = getDefaultParent(request))) { - hierarchyNote(request, HIER_DEFAULT_PARENT, 0, e->host); - } else if ((e = getSingleParent(request))) { - hierarchyNote(request, HIER_SINGLE_PARENT, 0, e->host); - } else if ((e = getRoundRobinParent(request))) { - hierarchyNote(request, HIER_ROUNDROBIN_PARENT, 0, e->host); - } else if ((e = getFirstUpParent(request))) { - hierarchyNote(request, HIER_FIRSTUP_PARENT, 0, e->host); + } else if ((e = peerGetSomeParent(request, &code))) { + hierarchyNote(request, code, 0, e->host); } else { hierarchyNote(request, HIER_DIRECT, 0, request->host); } diff --git a/src/tunnel.cc b/src/tunnel.cc index 3c438afe8e..c2fd528d11 100644 --- a/src/tunnel.cc +++ b/src/tunnel.cc @@ -1,6 +1,6 @@ /* - * $Id: tunnel.cc,v 1.38 1997/02/19 23:53:43 wessels Exp $ + * $Id: tunnel.cc,v 1.39 1997/02/25 19:18:24 wessels Exp $ * * DEBUG: section 26 Secure Sockets Layer Proxy * AUTHOR: Duane Wessels @@ -491,23 +491,11 @@ sslSelectNeighbor(int fd, const ipcache_addrs * ia, void *data) request_t *request = sslState->request; peer *e = NULL; peer *g = NULL; - int fw_ip_match = IP_ALLOW; - if (ia && Config.firewall_ip_list) - fw_ip_match = ip_access_check(ia->in_addrs[ia->cur], Config.firewall_ip_list); - if (matchInsideFirewall(request->host)) { + hier_code code; + if (peerSelectDirect(request)) { hierarchyNote(request, HIER_DIRECT, 0, request->host); - } else if (fw_ip_match == IP_DENY) { - hierarchyNote(request, HIER_FIREWALL_IP_DIRECT, 0, request->host); - } else if ((e = Config.sslProxy)) { - hierarchyNote(request, HIER_SSL_PARENT, 0, e->host); - } else if ((e = getDefaultParent(request))) { - hierarchyNote(request, HIER_DEFAULT_PARENT, 0, e->host); - } else if ((e = getSingleParent(request))) { - hierarchyNote(request, HIER_SINGLE_PARENT, 0, e->host); - } else if ((e = getRoundRobinParent(request))) { - hierarchyNote(request, HIER_ROUNDROBIN_PARENT, 0, e->host); - } else if ((e = getFirstUpParent(request))) { - hierarchyNote(request, HIER_FIRSTUP_PARENT, 0, e->host); + } else if ((e = peerGetSomeParent(request, &code))) { + hierarchyNote(request, code, 0, e->host); } else { hierarchyNote(request, HIER_DIRECT, 0, request->host); } -- 2.47.2