]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Merge from trunk
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Jul 2010 08:38:07 +0000 (20:38 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Jul 2010 08:38:07 +0000 (20:38 +1200)
15 files changed:
1  2 
doc/release-notes/release-3.2.sgml
src/Makefile.am
src/cache_cf.cc
src/cf.data.pre
src/client_side.cc
src/comm.cc
src/comm.h
src/comm/ListenStateData.cc
src/comm/ListenStateData.h
src/http.cc
src/icp_v2.cc
src/main.cc
src/protos.h
src/snmp_core.cc
src/structs.h

index 9dc15ffda54943a51360979585f6170ab30495c9,f5256caeb704c81eb804371304d6bbd53519e1d9..21f59059004f2cc4c6734704a73c4216a55aee13
@@@ -171,10 -223,12 +223,16 @@@ This section gives a thorough account o
        <p>Access control based on altered HTTP request following adaptation alterations (ICAP, eCAP, URL rewriter).
        An upgraded drop-in replacement for <em>http_access2</em> found in Squid-2.
  
 +      <tag>connect_retries</tag>
 +      <p>Replacement for <em>maximum_single_addr_tries</em>, but instead of only applying to hosts with single addresses.
 +      This directive applies to all hosts, extending the number of connection attempts to each IP address.
 +
+       <tag>else</tag>
+       <p>Part of conditional SMP support syyntax. see <em>if</em>
+       <tag>endif</tag>
+       <p>Part of conditional SMP support syyntax. see <em>if</em>
        <tag>eui_lookup</tag>
        <p>Whether to lookup the EUI or MAC address of a connected client.
  
diff --cc src/Makefile.am
Simple merge
diff --cc src/cache_cf.cc
Simple merge
diff --cc src/cf.data.pre
Simple merge
index 70c2f7ed889f09ca76e3ce3891acb8bceb1ca691,ba03e748f09083a591b8f3a63d0f79408239ae9e..b01e699ba47926ad3482f26f34a90cc74d426c1d
@@@ -85,6 -85,6 +85,7 @@@
  
  #include "acl/FilledChecklist.h"
  #include "auth/UserRequest.h"
++#include "base/TextException.h"
  #include "ChunkedCodingParser.h"
  #include "client_side.h"
  #include "client_side_reply.h"
diff --cc src/comm.cc
index d7bf01d583914cdb180a266c6bdcfbfdfcb43d3d,6330270bbd1055b60c0a6b53011d1ffa467f7f79..f3fde6ab78898b865154c44925ea8e03b4e089f0
@@@ -791,8 -856,151 +824,46 @@@ comm_apply_flags(int new_socket
      return new_socket;
  }
  
 -
 -CBDATA_CLASS_INIT(ConnectStateData);
 -
 -void *
 -ConnectStateData::operator new (size_t size)
 -{
 -    CBDATA_INIT_TYPE(ConnectStateData);
 -    return cbdataAlloc(ConnectStateData);
 -}
 -
 -void
 -ConnectStateData::operator delete (void *address)
 -{
 -    cbdataFree(address);
 -}
 -
 -
 -
 -void
 -commConnectStart(int fd, const char *host, u_short port, AsyncCall::Pointer &cb)
 -{
 -    debugs(cb->debugSection, cb->debugLevel, "commConnectStart: FD " << fd <<
 -           ", cb " << cb << ", " << host << ":" << port); // TODO: just print *cb
 -
 -    ConnectStateData *cs;
 -    cs = new ConnectStateData;
 -    cs->fd = fd;
 -    cs->host = xstrdup(host);
 -    cs->default_port = port;
 -    cs->callback = cb;
 -
 -    comm_add_close_handler(fd, commConnectFree, cs);
 -    ipcache_nbgethostbyname(host, commConnectDnsHandle, cs);
 -}
 -
 -// TODO: Remove this and similar callback registration functions by replacing
 -// (callback,data) parameters with an AsyncCall so that we do not have to use
 -// a generic call name and debug level when creating an AsyncCall. This will
 -// also cut the number of callback registration routines in half.
 -void
 -commConnectStart(int fd, const char *host, u_short port, CNCB * callback, void *data)
 -{
 -    debugs(5, 5, "commConnectStart: FD " << fd << ", data " << data << ", " << host << ":" << port);
 -    AsyncCall::Pointer call = commCbCall(5,3,
 -                                         "SomeCommConnectHandler", CommConnectCbPtrFun(callback, data));
 -    commConnectStart(fd, host, port, call);
 -}
 -
 -static void
 -commConnectDnsHandle(const ipcache_addrs *ia, const DnsLookupDetails &details, void *data)
 -{
 -    ConnectStateData *cs = (ConnectStateData *)data;
 -    cs->dns = details;
 -
 -    if (ia == NULL) {
 -        debugs(5, 3, "commConnectDnsHandle: Unknown host: " << cs->host);
 -        cs->callCallback(COMM_ERR_DNS, 0);
 -        return;
 -    }
 -
 -    assert(ia->cur < ia->count);
 -
 -    cs->default_addr = ia->in_addrs[ia->cur];
 -
 -    if (Config.onoff.balance_on_multiple_ip)
 -        ipcacheCycleAddr(cs->host, NULL);
 -
 -    cs->addrcount = ia->count;
 -
 -    cs->connstart = squid_curtime;
 -
 -    cs->connect();
 -}
 -
 -void
 -ConnectStateData::callCallback(comm_err_t status, int xerrno)
 -{
 -    debugs(5, 3, "commConnectCallback: FD " << fd);
 -
 -    comm_remove_close_handler(fd, commConnectFree, this);
 -    commSetTimeout(fd, -1, NULL, NULL);
 -
 -    typedef CommConnectCbParams Params;
 -    Params &params = GetCommParams<Params>(callback);
 -    params.fd = fd;
 -    params.dns = dns;
 -    params.flag = status;
 -    params.xerrno = xerrno;
 -    ScheduleCallHere(callback);
 -    callback = NULL;
 -
 -    commConnectFree(fd, this);
 -}
 -
 -static void
 -commConnectFree(int fd, void *data)
 -{
 -    ConnectStateData *cs = (ConnectStateData *)data;
 -    debugs(5, 3, "commConnectFree: FD " << fd);
 -//    delete cs->callback;
 -    cs->callback = NULL;
 -    safe_free(cs->host);
 -    delete cs;
 -}
 -
+ void
+ comm_import_opened(int fd,
+                    Ip::Address &addr,
+                    int flags,
+                    const char *note,
+                    struct addrinfo *AI)
+ {
+     debugs(5, 2, HERE << " FD " << fd << " at " << addr);
+     assert(fd >= 0);
+     assert(AI);
+     comm_init_opened(fd, addr, 0, note, AI);
+     if (!(flags & COMM_NOCLOEXEC))
+         fd_table[fd].flags.close_on_exec = 1;
+     if (addr.GetPort() > (u_short) 0) {
+ #ifdef _SQUID_MSWIN_
+         if (sock_type != SOCK_DGRAM)
+ #endif
+             fd_table[fd].flags.nolinger = 1;
+     }
+     if ((flags & COMM_TRANSPARENT))
+         fd_table[fd].flags.transparent = 1;
+     if (flags & COMM_NONBLOCKING)
+         fd_table[fd].flags.nonblocking = 1;
+ #ifdef TCP_NODELAY
+     if (AI->ai_socktype == SOCK_STREAM)
+         fd_table[fd].flags.nodelay = 1;
+ #endif
+     /* no fd_table[fd].flags. updates needed for these conditions:
+      * if ((flags & COMM_REUSEADDR)) ...
+      * if ((flags & COMM_DOBIND) ...) ...
+      */
+ }
  static void
  copyFDFlags(int to, fde *F)
  {
diff --cc src/comm.h
Simple merge
index 50a1eedb2d6102563eb3e8b98c4b4c5cd9dbb760,4e5a304831b5c74806dde63863c3f5ada73f5b95..ce3faef69400973344fcf0b1fb5c8fa856da13e3
@@@ -171,10 -172,9 +172,9 @@@ Comm::ListenStateData::acceptOne(
      }
  
      debugs(5, 5, HERE << "accepted: FD " << fd <<
 -           " newfd: " << newfd << " from: " << connDetails.peer <<
 +           " newfd: " << newfd << " from: " << connDetails->remote <<
-            " handler: " << *theCallback);
+            " handler: " << theCallback);
      notify(newfd, COMM_OK, 0, connDetails);
-     return true;
  }
  
  void
index 6372d2f661dda8761711ebb5804bccfb0eda38a6,66ed358786c465fe090d8c2c6912cdc19a4bd706..4b1dda706e8dfdfe2e8830684ac884dcc9d15aa4
@@@ -43,8 -41,8 +43,8 @@@ private
      /// Method callback for whenever an FD is ready to accept a client connection.
      static void doAccept(int fd, void *data);
  
-     bool acceptOne();
+     void acceptOne();
 -    int oldAccept(ConnectionDetail &details);
 +    int oldAccept(Comm::Connection &details);
  
      AsyncCall::Pointer theCallback;
      bool mayAcceptMore;
diff --cc src/http.cc
Simple merge
diff --cc src/icp_v2.cc
index c53738cd43fa2d3bd584caa088d18f9167730d3b,cb1e4cde5cbced6d37d664b0784347f0ed726c6b..b321bc409a171a1b3a66c3ec7b8189a63c814bf4
   */
  
  #include "squid.h"
 -#include "Store.h"
 -#include "comm.h"
 -#include "ICP.h"
 -#include "HttpRequest.h"
 -#include "acl/FilledChecklist.h"
 -#include "acl/Acl.h"
  #include "AccessLogEntry.h"
 -#include "wordlist.h"
 -#include "SquidTime.h"
 -#include "SwapDir.h"
 +#include "acl/Acl.h"
 +#include "acl/FilledChecklist.h"
 +#include "comm/Connection.h"
 +#include "HttpRequest.h"
  #include "icmp/net_db.h"
 +#include "ICP.h"
  #include "ip/Address.h"
+ #include "ipc/StartListening.h"
  #include "rfc1738.h"
 +#include "Store.h"
 +#include "SquidTime.h"
 +#include "SwapDir.h"
 +#include "wordlist.h"
  
+ /// dials icpIncomingConnectionOpened call
+ class IcpListeningStartedDialer: public CallDialer,
+         public Ipc::StartListeningCb
+ {
+ public:
+     typedef void (*Handler)(int fd, int errNo, Ip::Address& addr);
+     IcpListeningStartedDialer(Handler aHandler, Ip::Address& anAddr):
+             handler(aHandler), addr(anAddr) {}
+     virtual void print(std::ostream &os) const {
+         startPrint(os) <<
+         ", address=" << addr << ')';
+     }
+     virtual bool canDial(AsyncCall &) const { return true; }
+     virtual void dial(AsyncCall &) { (handler)(fd, errNo, addr); }
+ public:
+     Handler handler;
+     Ip::Address addr;
+ };
+ static void icpIncomingConnectionOpened(int fd, int errNo, Ip::Address& addr);
  /// \ingroup ServerProtocolICPInternal2
  static void icpLogIcp(const Ip::Address &, log_type, int, const char *, int);
  
diff --cc src/main.cc
Simple merge
diff --cc src/protos.h
Simple merge
index 7330f5d997e2925c378bc0247b07444cc80b7137,74dce91e7eecb08db832b4f246ebda3aae6ffc02..1781eedb07787be7cd3350308fb87a29edda33f0
@@@ -33,7 -33,7 +33,8 @@@
  #include "acl/FilledChecklist.h"
  #include "cache_snmp.h"
  #include "comm.h"
 +#include "comm/Connection.h"
+ #include "ipc/StartListening.h"
  #include "compat/strsep.h"
  #include "ip/Address.h"
  
diff --cc src/structs.h
Simple merge