From: Amos Jeffries Date: Fri, 21 May 2010 04:17:56 +0000 (+1200) Subject: Sync socket family type to the outgoing address family. X-Git-Tag: take08~55^2~124^2~144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75eb730e2b93993e32f9e45511233103ad1b37d5;p=thirdparty%2Fsquid.git Sync socket family type to the outgoing address family. 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. --- diff --git a/src/comm/ConnectStateData.cc b/src/comm/ConnectStateData.cc index 7adfd5d096..983f0f8493 100644 --- a/src/comm/ConnectStateData.cc +++ b/src/comm/ConnectStateData.cc @@ -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); diff --git a/src/forward.cc b/src/forward.cc index 8da4a2ea65..ffa621c9ba 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -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;