]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Sync socket family type to the outgoing address family.
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 21 May 2010 04:17:56 +0000 (16:17 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 21 May 2010 04:17:56 +0000 (16:17 +1200)
This evades the COMM_ERR_PROTOCOL results from comm_connect_addr.
Ideally those errors would now be unused, however there are still
components which call comm_connect_addr directly.

src/comm/ConnectStateData.cc
src/forward.cc

index 7adfd5d096e4fa00e70bbe6e789a6afb9c3ae5b8..983f0f8493b250c6125fcd4d33f039677e362fa4 100644 (file)
@@ -95,6 +95,12 @@ ConnectStateData::connect()
 
         /* find some socket we can use. will also bind the local address to it if needed. */
         while(paths->size() > 0 && (*i)->fd <= 0) {
+#if USE_IPV6
+            /* outbound sockets have no need to be protocol agnostic. */
+            if ((*i)->local.IsIPv6() && (*i)->local.IsIPv4()) {
+                (*i)->local.SetIPv4();
+            }
+#endif
             (*i)->fd = comm_openex(SOCK_STREAM, IPPROTO_TCP, (*i)->local, (*i)->flags, (*i)->tos, host);
             if ((*i)->fd <= 0) {
                 debugs(5 , 2, HERE << "Unable to connect " << (*i)->local << " -> " << (*i)->remote << " for " << host);
index 8da4a2ea65101e657c82e425ad247972ff17b9bb..ffa621c9bafbbe3845cf214e9012265ad87d3124 100644 (file)
@@ -1127,9 +1127,7 @@ FwdState::logReplyStatus(int tries, http_status status)
     if (status > HTTP_INVALID_HEADER)
         return;
 
-    assert(tries);
-
-    tries--;
+    assert(tries >= 0);
 
     if (tries > MAX_FWD_STATS_IDX)
         tries = MAX_FWD_STATS_IDX;