From: kostas <> Date: Sun, 21 Dec 1997 18:00:19 +0000 (+0000) Subject: Modified for AS support. We need to know the ip address before going X-Git-Tag: SQUID_3_0_PRE1~4356 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de7ba6896dd9a58ecde019fd6cfbd0da49794e45;p=thirdparty%2Fsquid.git Modified for AS support. We need to know the ip address before going to PeerSelectFoo() and neighborCount() because AclMatchAcl() can't block (and it would be more complicated to make a n-b version of it) --- diff --git a/src/peer_select.cc b/src/peer_select.cc index edc59b83fe..e3c8dc0d19 100644 --- a/src/peer_select.cc +++ b/src/peer_select.cc @@ -1,6 +1,6 @@ /* - * $Id: peer_select.cc,v 1.33 1997/11/20 06:25:29 wessels Exp $ + * $Id: peer_select.cc,v 1.34 1997/12/21 11:00:19 kostas Exp $ * * DEBUG: section 44 Peer Selection Algorithm * AUTHOR: Duane Wessels @@ -64,9 +64,11 @@ static char *DirectStr[] = }; static void peerSelectFoo(ps_state *); +static void peerSelectCheckAS(ps_state *); static void peerPingTimeout(void *data); static void peerSelectCallbackFail(ps_state * psstate); static IRCB peerHandleIcpReply; +static IPH peerSelectCheckASDone; static void peerSelectStateFree(ps_state * psstate); static void peerIcpParentMiss(peer *, icp_common_t *, ps_state *); static int peerCheckNetdbDirect(ps_state * psstate); @@ -112,6 +114,7 @@ peer * peerGetSomeParent(request_t * request, hier_code * code) { peer *p; + debug(44, 3) ("peerGetSomeParent: called.\n"); if ((p = getDefaultParent(request))) { *code = DEFAULT_PARENT; return p; @@ -151,9 +154,33 @@ peerSelect(request_t * request, psstate->callback_data = callback_data; cbdataLock(callback_data); psstate->icp.start = current_time; + peerSelectCheckAS(psstate); +} + +static void +peerSelectCheckASDone(const ipcache_addrs * ia, void *data) +{ + ps_state *psstate = data; peerSelectFoo(psstate); } +static void +peerSelectCheckAS(ps_state * psstate) +{ + request_t *request = psstate->request; + +/* XXXX Just a quick hack to get the destination address to the + * ipcache, because peerSelectIcpPing requires non-blocking ACL + * check. + * We should handle AS acl's differently than cache_host ones. */ + + ipcache_nbgethostbyname(request->host, + peerSelectCheckASDone, + psstate); + return; +} + + static void peerCheckNeverDirectDone(int answer, void *data) { @@ -297,6 +324,7 @@ peerSelectFoo(ps_state * psstate) } debug_trap("peerSelect: neighborsUdpPing returned 0"); } + debug(44, 3) ("peerSelectFoo: After peerSelectIcpPing.\n"); if (peerCheckNetdbDirect(psstate)) { code = CLOSEST_DIRECT; debug(44, 3) ("peerSelect: %s/%s\n", hier_strings[code], request->host);