]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Merge from trunk
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Jan 2009 05:28:23 +0000 (18:28 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 13 Jan 2009 05:28:23 +0000 (18:28 +1300)
1  2 
src/client_side.cc
src/client_side_reply.cc
src/forward.cc
src/forward.h
src/http.cc
src/ipcache.cc
src/pconn.cc
src/pconn.h

Simple merge
Simple merge
diff --cc src/forward.cc
index d29e2cf044aa37833ce86ffb797f92ea4b00acaf,0c5ebd4e219dd52405c99d67fe565a6f72126f0b..87efed8b29ac5e7b0c2bd151768d4d6ba2440e6a
@@@ -1175,11 -1176,24 +1176,24 @@@ FwdState::reforwardableStatus(http_stat
      /* NOTREACHED */
  }
  
+ /**
+  * Decide where details need to be gathered to correctly describe a persistent connection.
+  * What is needed:
+  * \item  host name of server at other end of this link (either peer or requested host)
+  * \item  port to which we connected the other end of this link (for peer or request)
+  * \item  domain for which the connection is supposed to be used
+  * \item  address of the client for which we made the connection
+  */
  void
- FwdState::pconnPush(int fd, const char *host, int port, const char *domain, IpAddress &client_addr)
 -FwdState::pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IPAddress &client_addr)
++FwdState::pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IpAddress &client_addr)
  {
-     fwdPconnPool->push(fd, host, port, domain, client_addr);
+     if (_peer) {
+         fwdPconnPool->push(fd, _peer->name, _peer->http_port, domain, client_addr);
+     } else {
+         /* small performance improvement, using NULL for domain instead of listing it twice */
+         /* although this will leave a gap open for url-rewritten domains to share a link */
+         fwdPconnPool->push(fd, req->GetHost(), req->port, NULL, client_addr);
+     }
  }
  
  void
diff --cc src/forward.h
index e77c1ce68bb772b2ddd2f6b59ca61c00e88139c6,d82dc188642fdff5cf6e339e36ae8efd05fbd8cd..065ad08bcc6857af6302679e3008ce9109c15ded
@@@ -4,9 -4,10 +4,10 @@@
  /* forward decls */
  
  class ErrorState;
+ class HttpRequest;
  
  #include "comm.h"
 -#include "IPAddress.h"
 +#include "ip/IpAddress.h"
  
  class FwdServer
  {
@@@ -43,7 -44,7 +44,7 @@@ public
      bool checkRetry();
      bool checkRetriable();
      void dispatch();
-     void pconnPush(int fd, const char *host, int port, const char *domain, IpAddress &client_addr);
 -    void pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IPAddress &client_addr);
++    void pconnPush(int fd, const peer *_peer, const HttpRequest *req, const char *domain, IpAddress &client_addr);
  
      bool dontRetry() { return flags.dont_retry; }
  
diff --cc src/http.cc
Simple merge
diff --cc src/ipcache.cc
Simple merge
diff --cc src/pconn.cc
index 07241024a962bb6af188a50a79671e9190b9e08a,6d1790e2a0d1a0147970199eeb072ab682880bb2..223e8022efb3bff41eeb519342cdd9019744f9fb
@@@ -178,9 -177,9 +177,9 @@@ IdleConnList::timeout(int fd, void *dat
  /* ========== PconnPool PRIVATE FUNCTIONS ============================================ */
  
  const char *
 -PconnPool::key(const char *host, u_short port, const char *domain, IPAddress &client_address)
 +PconnPool::key(const char *host, u_short port, const char *domain, IpAddress &client_address)
  {
-     LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 2 + 10);
+     LOCAL_ARRAY(char, buf, SQUIDHOSTNAMELEN * 3 + 10);
      char ntoabuf[MAX_IPSTRLEN];
  
      if (domain && !client_address.IsAnyAddr())
@@@ -273,15 -289,17 +289,17 @@@ PconnPool::push(int fd, const char *hos
   * transactions create persistent connections but are not retriable.
   */
  int
 -PconnPool::pop(const char *host, u_short port, const char *domain, IPAddress &client_address, bool isRetriable)
 +PconnPool::pop(const char *host, u_short port, const char *domain, IpAddress &client_address, bool isRetriable)
  {
-     IdleConnList *list;
      const char * aKey = key(host, port, domain, client_address);
-     list = (IdleConnList *)hash_lookup(table, aKey);
  
-     if (list == NULL)
+     IdleConnList *list = (IdleConnList *)hash_lookup(table, aKey);
+     if (list == NULL) {
+         debugs(48, 3, "PconnPool::pop: lookup for key {" << aKey << "} failed.");
          return -1;
+     } else { 
+         debugs(48, 3, "PconnPool::pop: found " << hashKeyStr(&list->hash) << (isRetriable?"(to use)":"(to kill)") );
+     }
  
      int fd = list->findUseableFD(); // search from the end. skip pending reads.
  
diff --cc src/pconn.h
index 982fa8b43286f0e885ae703bc0339307658bc270,836c04e912aa1063aef988de10236aa2f40628cd..60df8551a4912f46bab7d9e02c479b8f59b52bc6
@@@ -72,10 -72,11 +72,11 @@@ public
      PconnPool(const char *);
  
      void moduleInit();
 -    void push(int fd, const char *host, u_short port, const char *domain, IPAddress &client_address);
 -    int pop(const char *host, u_short port, const char *domain, IPAddress &client_address, bool retriable);
 +    void push(int fd, const char *host, u_short port, const char *domain, IpAddress &client_address);
 +    int pop(const char *host, u_short port, const char *domain, IpAddress &client_address, bool retriable);
      void count(int uses);
      void dumpHist(StoreEntry *e);
+     void dumpHash(StoreEntry *e);
      void unlinkList(IdleConnList *list) const;
  
  private: