]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Merge from trunk
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 4 Sep 2010 15:09:33 +0000 (03:09 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 4 Sep 2010 15:09:33 +0000 (03:09 +1200)
1  2 
doc/release-notes/release-3.2.sgml
src/Makefile.am
src/cf.data.pre
src/client_side.cc
src/dns_internal.cc

Simple merge
diff --cc src/Makefile.am
Simple merge
diff --cc src/cf.data.pre
Simple merge
Simple merge
index d021190b2e83b797359812ba8dff112d459b3183,b2668dc477586c8c8c6cefac87f28693d8403d07..259e688c60d126f564fd09ceaea984304af4b55c
@@@ -705,13 -704,16 +705,17 @@@ idnsDoSendQueryVC(nsvc *vc
  }
  
  static void
- idnsInitVCConnected(const Comm::ConnectionPointer &conn, comm_err_t status, int xerrno, void *data)
 -idnsInitVCConnected(int fd, const DnsLookupDetails &details, comm_err_t status, int xerrno, void *data)
++idnsInitVCConnected(const Comm::ConnectionPointer &conn, const DnsLookupDetails &details, comm_err_t status, int xerrno, void *data)
  {
      nsvc * vc = (nsvc *)data;
  
 -    if (status != COMM_OK) {
 +    if (status != COMM_OK || !conn) {
-         char buf[MAX_IPSTRLEN];
-         debugs(78, DBG_IMPORTANT, "Failed to connect to nameserver " << nameservers[vc->ns].S.NtoA(buf,MAX_IPSTRLEN) << " using TCP!");
+         char buf[MAX_IPSTRLEN] = "";
+         if (vc->ns < nns)
+             nameservers[vc->ns].S.NtoA(buf,MAX_IPSTRLEN);
+         debugs(78, 1, HERE << "Failed to connect to nameserver " << buf << " using TCP: " << details);
 -        comm_close(fd);
++        Comm::ConnectionPOinter nonConst = conn;
++        nonConst->close();
          return;
      }
  
@@@ -736,27 -736,44 +741,28 @@@ idnsVCClosed(int fd, void *data
  static void
  idnsInitVC(int ns)
  {
 -    char buf[MAX_IPSTRLEN];
 -
      nsvc *vc = cbdataAlloc(nsvc);
+     assert(ns < nns);
      nameservers[ns].vc = vc;
      vc->ns = ns;
 -
 -    Ip::Address addr;
 -
 -    if (!Config.Addrs.udp_outgoing.IsNoAddr())
 -        addr = Config.Addrs.udp_outgoing;
 -    else
 -        addr = Config.Addrs.udp_incoming;
 -
 -    if (nameservers[ns].S.IsIPv4() && !addr.SetIPv4()) {
 -        debugs(31, DBG_CRITICAL, "ERROR: Cannot contact DNS nameserver " << nameservers[ns].S << " from " << addr);
 -        addr.SetAnyAddr();
 -        addr.SetIPv4();
 -    }
 -
      vc->queue = new MemBuf;
 -
      vc->msg = new MemBuf;
 +    vc->busy = 1;
  
 -    vc->fd = comm_open(SOCK_STREAM,
 -                       IPPROTO_TCP,
 -                       addr,
 -                       COMM_NONBLOCKING,
 -                       "DNS TCP Socket");
 +    Comm::ConnectionPointer conn = new Comm::Connection;
  
 -    if (vc->fd < 0)
 -        fatal("Could not create a DNS socket");
 +    if (!Config.Addrs.udp_outgoing.IsNoAddr())
 +        conn->local = Config.Addrs.udp_outgoing;
 +    else
 +        conn->local = Config.Addrs.udp_incoming;
  
 -    comm_add_close_handler(vc->fd, idnsVCClosed, vc);
 +    conn->remote = nameservers[ns].S;
  
 -    vc->busy = 1;
 +    AsyncCall::Pointer call = commCbCall(78,3, "idnsInitVCConnected", CommConnectCbPtrFun(idnsInitVCConnected, vc));
  
 -    commConnectStart(vc->fd, nameservers[ns].S.NtoA(buf,MAX_IPSTRLEN), nameservers[ns].S.GetPort(), idnsInitVCConnected, vc);
 +    Comm::ConnOpener *cs = new Comm::ConnOpener(conn, call, Config.Timeout.connect);
 +    cs->setHost("DNS TCP Socket");
 +    AsyncJob::Start(cs);
  }
  
  static void