From: Amos Jeffries Date: Fri, 17 Jun 2011 10:41:10 +0000 (+1200) Subject: Connection opening is done by Comm::ConnOpener X-Git-Tag: take08~55^2~124^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=919fc80d76844ef20a7d20b569d70a6496cb8484;p=thirdparty%2Fsquid.git Connection opening is done by Comm::ConnOpener --- diff --git a/src/adaptation/icap/ServiceRep.cc b/src/adaptation/icap/ServiceRep.cc index 486934fafb..1b775e5490 100644 --- a/src/adaptation/icap/ServiceRep.cc +++ b/src/adaptation/icap/ServiceRep.cc @@ -85,8 +85,6 @@ void Adaptation::Icap::ServiceRep::noteFailure() Comm::ConnectionPointer Adaptation::Icap::ServiceRep::getConnection(bool retriableXact, bool &reused) { - Ip::Address client_addr; - Comm::ConnectionPointer connection; /* 2011-06-17: rousskov: @@ -108,22 +106,12 @@ Adaptation::Icap::ServiceRep::getConnection(bool retriableXact, bool &reused) else theIdleConns.closeN(1); - reused = Comm::IsConnOpen(connection); // reused a persistent connection - - if (!reused) { // need a new connection - Ip::Address outgoing; // default: IP6_ANY_ADDR - if (!Ip::EnableIpv6) - outgoing.SetIPv4(); - else if (Ip::EnableIpv6&IPV6_SPECIAL_SPLITSTACK && !cfg().ipv6) { - /* split-stack for now requires default IPv4-only socket */ - outgoing.SetIPv4(); - } - connection = comm_open(SOCK_STREAM, 0, outgoing, COMM_NONBLOCKING, cfg().uri.termedBuf()); - } else + if (!(reused = Comm::IsConnOpen(connection))) + connection = new Comm::Connection; + else { debugs(93,3, HERE << "reused pconn " << connection); - - if (Comm::IsConnOpen(connection)) ++theBusyConns; + } return connection; } diff --git a/src/adaptation/icap/Xaction.cc b/src/adaptation/icap/Xaction.cc index 96561048a6..a305eee4dd 100644 --- a/src/adaptation/icap/Xaction.cc +++ b/src/adaptation/icap/Xaction.cc @@ -124,6 +124,10 @@ Adaptation::Icap::Xaction::openConnection() // Attempt to open a new connection... debugs(93,3, typeName << " opens connection to " << s.cfg().host.termedBuf() << ":" << s.cfg().port); + // TODO: find the IPs and attempt each one if this is a named service. + connection->remote = s.cfg().host.termedBuf(); + connection->remote.SetPort(s.cfg().port); + // TODO: service bypass status may differ from that of a transaction typedef CommCbMemFunT TimeoutDialer; AsyncCall::Pointer timeoutCall = asyncCall(93, 5, "Adaptation::Icap::Xaction::noteCommTimedout",