]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Connection opening is done by Comm::ConnOpener
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 17 Jun 2011 10:41:10 +0000 (22:41 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 17 Jun 2011 10:41:10 +0000 (22:41 +1200)
src/adaptation/icap/ServiceRep.cc
src/adaptation/icap/Xaction.cc

index 486934fafbb2cfe7b2c399353f79e5c6572e77f5..1b775e54901b9d5961b6e92dbef0a3a5dcddfe9e 100644 (file)
@@ -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;
 }
index 96561048a6fc737db71a018dfaf8d0736cfb81af..a305eee4ddb0d5ac777a43b73f35f32126db93d1 100644 (file)
@@ -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<Adaptation::Icap::Xaction, CommTimeoutCbParams> TimeoutDialer;
     AsyncCall::Pointer timeoutCall =  asyncCall(93, 5, "Adaptation::Icap::Xaction::noteCommTimedout",