]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Merged from parent (trunk r11379, v3.2.0.6+).
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 14 Apr 2011 16:58:28 +0000 (10:58 -0600)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 14 Apr 2011 16:58:28 +0000 (10:58 -0600)
36 files changed:
1  2 
configure.ac
src/Makefile.am
src/MemObject.cc
src/Server.cc
src/adaptation/icap/ServiceRep.h
src/adaptation/icap/Xaction.cc
src/cache_cf.cc
src/cf.data.pre
src/client_side.cc
src/client_side_reply.cc
src/disk.cc
src/fs/coss/store_dir_coss.cc
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.h
src/ipc/Coordinator.cc
src/ipc/Coordinator.h
src/ipc/Forwarder.cc
src/ipc/Kid.cc
src/ipc/Kid.h
src/ipc/Kids.cc
src/ipc/Kids.h
src/ipc/Makefile.am
src/ipc/Messages.h
src/ipc/Strand.cc
src/ipc/Strand.h
src/ipc/forward.h
src/log/FormatSquidCustom.cc
src/log/Tokens.h
src/main.cc
src/mem.cc
src/neighbors.cc
src/protos.h
src/store.cc
src/structs.h
src/tools.cc
src/urn.cc

diff --cc configure.ac
Simple merge
diff --cc src/Makefile.am
index 7d8090fcfa89806ee2e405b9240a825fabd785f3,27d715dfeece67eb51d4570f6ab4f3374320edce..e2014bd5e791bee0c8fcbdfeb0765f3921f00c75
@@@ -536,8 -537,20 +539,21 @@@ nodist_squid_SOURCES = 
        $(BUILT_SOURCES)
  
  squid_LDADD = \
-       $(COMMON_LIBS) \
+       $(AUTH_ACL_LIBS) \
+       ident/libident.la \
+       acl/libacls.la \
+       eui/libeui.la \
+       acl/libstate.la \
+       $(AUTH_LIBS) \
 +      $(DISK_LIBS) \
+       acl/libapi.la \
+       base/libbase.la \
+       libsquid.la \
+       ip/libip.la \
+       fs/libfs.la \
+       ipc/libipc.la \
+       mgr/libmgr.la \
+       anyp/libanyp.la \
        comm/libcomm.la \
        eui/libeui.la \
        icmp/libicmp.la icmp/libicmp-core.la \
@@@ -1265,10 -1348,9 +1366,9 @@@ tests_testCacheManager_SOURCES = 
        StoreMetaURL.cc \
        StoreMetaVary.cc \
        StoreSwapLogData.cc \
-       $(TEST_CALL_SOURCES) \
        tools.cc \
        tunnel.cc \
 -      SwapDir.cc \
 +      SwapDir.cc MemStore.cc MemStoreMap.cc \
        url.cc \
        URLScheme.cc \
        urn.cc \
@@@ -1466,10 -1646,17 +1664,18 @@@ tests_testEvent_SOURCES = 
        StoreMetaURL.cc \
        StoreMetaVary.cc \
        StoreSwapLogData.cc \
-       $(TEST_CALL_SOURCES) \
+       String.cc \
+       SwapDir.cc \
+       tests/CapturingStoreEntry.h \
+       tests/testEvent.cc \
+       tests/testEvent.h \
+       tests/testMain.cc \
+       tests/stub_main_cc.cc \
+       tests/stub_ipc_Forwarder.cc \
+       time.cc \
        tools.cc \
        tunnel.cc \
 +      SwapDir.cc MemStore.cc MemStoreMap.cc \
        url.cc \
        URLScheme.cc \
        urn.cc \
@@@ -1626,10 -1821,16 +1840,17 @@@ tests_testEventLoop_SOURCES = 
        StoreMetaURL.cc \
        StoreMetaVary.cc \
        StoreSwapLogData.cc \
-       $(TEST_CALL_SOURCES) \
+       String.cc \
+       SwapDir.cc \
+       tests/testEventLoop.cc \
+       tests/testEventLoop.h \
+       tests/testMain.cc \
+       tests/stub_main_cc.cc \
+       tests/stub_ipc_Forwarder.cc \
+       time.cc \
        tools.cc \
        tunnel.cc \
 +      SwapDir.cc MemStore.cc MemStoreMap.cc \
        url.cc \
        URLScheme.cc \
        urn.cc \
@@@ -1941,10 -2169,10 +2189,10 @@@ tests_testHttpRequest_SOURCES = 
        StoreMetaURL.cc \
        StoreMetaVary.cc \
        StoreSwapLogData.cc \
-       $(TEST_CALL_SOURCES) \
+       event.cc \
        tools.cc \
        tunnel.cc \
 -      SwapDir.cc \
 +      SwapDir.cc MemStore.cc MemStoreMap.cc \
        url.cc \
        URLScheme.cc \
        urn.cc \
@@@ -2388,10 -2875,10 +2928,10 @@@ tests_testURL_SOURCES = 
        StoreMetaURL.cc \
        StoreMetaVary.cc \
        StoreSwapLogData.cc \
-       $(TEST_CALL_SOURCES) \
+       event.cc \
        tools.cc \
        tunnel.cc \
 -      SwapDir.cc \
 +      SwapDir.cc MemStore.cc MemStoreMap.cc \
        urn.cc \
        wccp2.cc \
        whois.cc \
Simple merge
diff --cc src/Server.cc
Simple merge
Simple merge
Simple merge
diff --cc src/cache_cf.cc
Simple merge
diff --cc src/cf.data.pre
Simple merge
Simple merge
Simple merge
diff --cc src/disk.cc
Simple merge
Simple merge
Simple merge
Simple merge
index 8479da88be450659ce87872e709bde128b0d3846,02656fee3ded565fa7c8438e98a56a87a82d9a30..5823e9448494af14fd0320f8f116b2ad620ae4a2
@@@ -158,39 -154,27 +179,60 @@@ Ipc::Coordinator::handleCacheMgrRespons
      Mgr::Inquirer::HandleRemoteAck(response);
  }
  
 +void
 +Ipc::Coordinator::handleSearchRequest(const Ipc::StrandSearchRequest &request)
 +{
 +    // do we know of a strand with the given search tag?
 +    const StrandCoord *strand = NULL;
 +    typedef StrandCoords::const_iterator SCCI;
 +    for (SCCI i = strands_.begin(); !strand && i != strands_.end(); ++i) {
 +        if (i->tag == request.tag)
 +            strand = &(*i);
 +    }
 +
 +    if (strand) {
 +        notifySearcher(request, *strand);
 +        return;
 +      }
 +
 +    searchers.push_back(request);
 +    debugs(54, 3, HERE << "cannot yet tell kid" << request.requestorId <<
 +        " who " << request.tag << " is");
 +}
 +
 +void
 +Ipc::Coordinator::notifySearcher(const Ipc::StrandSearchRequest &request,
 +                                 const StrandCoord& strand)
 +{
 +    debugs(54, 3, HERE << "tell kid" << request.requestorId << " that " <<
 +        request.tag << " is kid" << strand.kidId);
 +    const StrandSearchResponse response(strand);
 +    TypedMsgHdr message;
 +    response.pack(message);
 +    SendMessage(MakeAddr(strandAddrPfx, request.requestorId), message);
 +}
 +
+ #if SQUID_SNMP
+ void
+ Ipc::Coordinator::handleSnmpRequest(const Snmp::Request& request)
+ {
+     debugs(54, 4, HERE);
+     Snmp::Response response(request.requestId);
+     TypedMsgHdr message;
+     response.pack(message);
+     SendMessage(MakeAddr(strandAddrPfx, request.requestorId), message);
+     AsyncJob::Start(new Snmp::Inquirer(request, strands_));
+ }
+ void
+ Ipc::Coordinator::handleSnmpResponse(const Snmp::Response& response)
+ {
+     debugs(54, 4, HERE);
+     Snmp::Inquirer::HandleRemoteAck(response);
+ }
+ #endif
  
  int
  Ipc::Coordinator::openListenSocket(const SharedListenRequest& request,
index f2f4da03a4ab4d2d19fcbbd3190f4ca8f8fdeaa2,bc0d8fd765de6c647101ee28d374aab725f38f24..9bd74d3c9e91e683a0f8bf4302d663e4f78f8d94
  #include "ipc/Port.h"
  #include "ipc/SharedListen.h"
  #include "ipc/StrandCoords.h"
 +#include "ipc/StrandSearch.h"
  #include "mgr/forward.h"
+ #if SQUID_SNMP
+ #include "snmp/forward.h"
+ #endif
 +
 +#include <list>
  #include <map>
  
++
  namespace Ipc
  {
  
index 0000000000000000000000000000000000000000,3650229a2d83da85910e24b56982c9d1eceef1b5..13d77f99c31989e430e00b480f1fe037006f63f2
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,177 +1,179 @@@
+ /*
+  * $Id$
+  *
+  * DEBUG: section 54    Interprocess Communication
+  *
+  */
+ #include "config.h"
+ #include "base/AsyncJobCalls.h"
+ #include "base/TextException.h"
+ #include "ipc/Forwarder.h"
+ #include "ipc/Port.h"
+ #include "ipc/TypedMsgHdr.h"
+ CBDATA_NAMESPACED_CLASS_INIT(Ipc, Forwarder);
+ Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap;
+ unsigned int Ipc::Forwarder::LastRequestId = 0;
+ Ipc::Forwarder::Forwarder(Request::Pointer aRequest, double aTimeout):
+         AsyncJob("Ipc::Forwarder"),
+         request(aRequest), timeout(aTimeout)
+ {
+     debugs(54, 5, HERE);
+ }
+ Ipc::Forwarder::~Forwarder()
+ {
+     debugs(54, 5, HERE);
+     Must(request->requestId == 0);
+     cleanup();
+ }
+ /// perform cleanup actions
+ void
+ Ipc::Forwarder::cleanup()
+ {
+ }
+ void
+ Ipc::Forwarder::start()
+ {
+     debugs(54, 3, HERE);
+     typedef NullaryMemFunT<Forwarder> Dialer;
+     AsyncCall::Pointer callback = JobCallback(54, 5, Dialer, this, Forwarder::handleRemoteAck);
+     if (++LastRequestId == 0) // don't use zero value as request->requestId
+         ++LastRequestId;
+     request->requestId = LastRequestId;
+     TheRequestsMap[request->requestId] = callback;
+     TypedMsgHdr message;
+     try {
+         request->pack(message);
+     } catch (...) {
+         // assume the pack() call failed because the message did not fit
+         // TODO: add a more specific exception?
+         handleError();
+     }
+     SendMessage(coordinatorAddr, message);
+     eventAdd("Ipc::Forwarder::requestTimedOut", &Forwarder::RequestTimedOut,
+              this, timeout, 0, false);
+ }
+ void
+ Ipc::Forwarder::swanSong()
+ {
+     debugs(54, 5, HERE);
+     removeTimeoutEvent();
+     if (request->requestId > 0) {
+         DequeueRequest(request->requestId);
+         request->requestId = 0;
+     }
+     cleanup();
+ }
+ bool
+ Ipc::Forwarder::doneAll() const
+ {
+     debugs(54, 5, HERE);
+     return request->requestId == 0;
+ }
+ /// called when Coordinator starts processing the request
+ void
+ Ipc::Forwarder::handleRemoteAck()
+ {
+     debugs(54, 3, HERE);
+     request->requestId = 0;
++    // Do not clear ENTRY_FWD_HDR_WAIT or do entry->complete() because
++    // it will trigger our client side processing. Let job cleanup close.
+ }
+ /// Ipc::Forwarder::requestTimedOut wrapper
+ void
+ Ipc::Forwarder::RequestTimedOut(void* param)
+ {
+     debugs(54, 3, HERE);
+     Must(param != NULL);
+     Forwarder* fwdr = static_cast<Forwarder*>(param);
+     // use async call to enable job call protection that time events lack
+     CallJobHere(54, 5, fwdr, Forwarder, requestTimedOut);
+ }
+ /// called when Coordinator fails to start processing the request [in time]
+ void
+ Ipc::Forwarder::requestTimedOut()
+ {
+     debugs(54, 3, HERE);
+     handleTimeout();
+ }
+ void
+ Ipc::Forwarder::handleError()
+ {
+     mustStop("error");
+ }
+ void
+ Ipc::Forwarder::handleTimeout()
+ {
+     mustStop("timeout");
+ }
+ /// terminate with an error
+ void
+ Ipc::Forwarder::handleException(const std::exception& e)
+ {
+     debugs(54, 3, HERE << e.what());
+     mustStop("exception");
+ }
+ void
+ Ipc::Forwarder::callException(const std::exception& e)
+ {
+     try {
+         handleException(e);
+     } catch (const std::exception& ex) {
+         debugs(54, DBG_CRITICAL, HERE << ex.what());
+     }
+     AsyncJob::callException(e);
+ }
+ /// returns and forgets the right Forwarder callback for the request
+ AsyncCall::Pointer
+ Ipc::Forwarder::DequeueRequest(unsigned int requestId)
+ {
+     debugs(54, 3, HERE);
+     Must(requestId != 0);
+     AsyncCall::Pointer call;
+     RequestsMap::iterator request = TheRequestsMap.find(requestId);
+     if (request != TheRequestsMap.end()) {
+         call = request->second;
+         Must(call != NULL);
+         TheRequestsMap.erase(request);
+     }
+     return call;
+ }
+ /// called when we are no longer waiting for Coordinator to respond
+ void
+ Ipc::Forwarder::removeTimeoutEvent()
+ {
+     if (eventFind(&Forwarder::RequestTimedOut, this))
+         eventDelete(&Forwarder::RequestTimedOut, this);
+ }
+ void
+ Ipc::Forwarder::HandleRemoteAck(unsigned int requestId)
+ {
+     debugs(54, 3, HERE);
+     Must(requestId != 0);
+     AsyncCall::Pointer call = DequeueRequest(requestId);
+     if (call != NULL)
+         ScheduleCallHere(call);
+ }
diff --cc src/ipc/Kid.cc
Simple merge
diff --cc src/ipc/Kid.h
Simple merge
diff --cc src/ipc/Kids.cc
Simple merge
diff --cc src/ipc/Kids.h
Simple merge
index 147917690ef3ce39641384869ed1b94a4c7cef8c,4cda3bba0a4a21a35dace70d7beb48b3444c48f7..6079e11782d1bfd0931800e8fb82751d3cc6adbf
@@@ -37,18 -28,12 +37,23 @@@ libipc_la_SOURCES = 
        Port.h \
        Strand.cc \
        Strand.h \
-       \
        forward.h \
 -      Response.h
+       Forwarder.cc \
+       Forwarder.h \
+       Inquirer.cc \
+       Inquirer.h \
+       Request.h \
++      Response.h \
 +      \
 +      mem/Page.cc \
 +      mem/Page.h \
 +      mem/PagePool.cc \
 +      mem/PagePool.h \
 +      mem/Pages.cc \
 +      mem/Pages.h \
 +      mem/PageStack.cc \
 +      mem/PageStack.h \
 +      mem/Segment.cc \
 +      mem/Segment.h
  
  DEFS += -DDEFAULT_PREFIX=\"$(prefix)\"
index e3ee4fa9a2c36a39d8a4b7c13b88072382cbcc40,2dafad156385a5552667f392ee82507604706ee9..12986ccd66d037802eaeb64815c74ef0a0aee31a
@@@ -18,10 -15,12 +15,14 @@@ namespace Ip
  
  /// message class identifier
  typedef enum { mtNone = 0, mtRegistration,
 +               mtStrandSearchRequest, mtStrandSearchResponse,
                 mtSharedListenRequest, mtSharedListenResponse,
 +               mtIpcIoNotification,
                 mtCacheMgrRequest, mtCacheMgrResponse
+ #if SQUID_SNMP
+                ,
+                mtSnmpRequest, mtSnmpResponse
+ #endif
               } MessageType;
  
  } // namespace Ipc;
index 0e76e04c8a4b557b917d031dd9ede26745a3747c,4d7bf6def351bff5ef29c1befaa0b31f9ca5bd3f..5794a3d77f4446331687acfad66c5f40d9441e5e
  #include "mgr/Request.h"
  #include "mgr/Response.h"
  #include "mgr/Forwarder.h"
 +#include "DiskIO/IpcIo/IpcIoFile.h" /* XXX: scope boundary violation */
 +#include "SwapDir.h" /* XXX: scope boundary violation */
  #include "CacheManager.h"
+ #if SQUID_SNMP
+ #include "snmp/Forwarder.h"
+ #include "snmp/Request.h"
+ #include "snmp/Response.h"
+ #endif
  
  CBDATA_NAMESPACED_CLASS_INIT(Ipc, Strand);
  
@@@ -61,21 -60,31 +65,39 @@@ void Ipc::Strand::receive(const TypedMs
          SharedListenJoined(SharedListenResponse(message));
          break;
  
-     case mtCacheMgrRequest:
-         handleCacheMgrRequest(Mgr::Request(message));
-         break;
 +    case mtStrandSearchResponse:
 +        IpcIoFile::HandleOpenResponse(StrandSearchResponse(message));
 +        break;
 +
 +    case mtIpcIoNotification:
 +        IpcIoFile::HandleNotification(message);
 +        break;
 +
+     case mtCacheMgrRequest: {
+         const Mgr::Request req(message);
+         handleCacheMgrRequest(req);
+     }
+     break;
  
-     case mtCacheMgrResponse:
-         handleCacheMgrResponse(Mgr::Response(message));
-         break;
+     case mtCacheMgrResponse: {
+         const Mgr::Response resp(message);
+         handleCacheMgrResponse(resp);
+     }
+     break;
+ #if SQUID_SNMP
+     case mtSnmpRequest: {
+         const Snmp::Request req(message);
+         handleSnmpRequest(req);
+     }
+     break;
+     case mtSnmpResponse: {
+         const Snmp::Response resp(message);
+         handleSnmpResponse(resp);
+     }
+     break;
+ #endif
  
      default:
          debugs(54, 1, HERE << "Unhandled message type: " << message.type());
index c6f84ba9fcec7411d754c74155ce55dc7ed2f273,e574b7bd0d3017de56f6eeee279df4ffe384df9a..30c7c5442c864d86cd7ea200f455a724e9842a24
@@@ -8,10 -8,11 +8,12 @@@
  #ifndef SQUID_IPC_STRAND_H
  #define SQUID_IPC_STRAND_H
  
 +#include "ipc/forward.h"
  #include "ipc/Port.h"
  #include "mgr/forward.h"
+ #if SQUID_SNMP
+ #include "snmp/forward.h"
+ #endif
  
  namespace Ipc
  {
@@@ -32,9 -33,13 +34,13 @@@ protected
  
  private:
      void registerSelf(); /// let Coordinator know this strand exists
 -    void handleRegistrationResponse(const StrandCoord &strand);
 +    void handleRegistrationResponse(const HereIamMessage &msg);
      void handleCacheMgrRequest(const Mgr::Request& request);
      void handleCacheMgrResponse(const Mgr::Response& response);
+ #if SQUID_SNMP
+     void handleSnmpRequest(const Snmp::Request& request);
+     void handleSnmpResponse(const Snmp::Response& response);
+ #endif
  
  private:
      bool isRegistered; ///< whether Coordinator ACKed registration (unused)
index 45a58a8e91576859e8007d5f8353cda3a5553fb1,f4ddf4cb0caeec111b66084ccfcab05b4bda875c..be25bdd89e8149a1835b634058232781766d7427
@@@ -13,8 -13,10 +13,12 @@@ namespace Ip
  
  class TypedMsgHdr;
  class StrandCoord;
 +class HereIamMessage;
 +class StrandSearchResponse;
+ class Forwarder;
+ class Inquirer;
+ class Request;
+ class Response;
  
  } // namespace Ipc
  
Simple merge
Simple merge
diff --cc src/main.cc
index 6459439e99cc9989c8bea2efb6162d127ac6764d,67e110fee9b83d5967b636c39ea3d04dc35b7e25..2a5bac5c4977f5ebeca1a39a8f22e2a61c21b360
  #if ICAP_CLIENT
  #include "adaptation/icap/icap_log.h"
  #endif
+ #if USE_AUTH
  #include "auth/Gadgets.h"
+ #endif
 +#include "base/RunnersRegistry.h"
  #include "base/TextException.h"
  #if USE_DELAY_POOLS
  #include "ClientDelayConfig.h"
@@@ -1754,13 -1750,16 +1774,18 @@@ syslog(LOG_NOTICE, "XXX: will start %d 
                             kid->getPid(), kid->exitStatus());
                  } else if (kid->signaled()) {
                      syslog(LOG_NOTICE,
 -                           "Squid Parent: child process %d exited due to signal %d with status %d",
 +                           "Squid Parent: %s process %d exited due to signal %d with status %d",
 +                           kid->name().termedBuf(),
                             kid->getPid(), kid->termSignal(), kid->exitStatus());
                  } else {
 -                    syslog(LOG_NOTICE, "Squid Parent: child process %d exited", kid->getPid());
 +                    syslog(LOG_NOTICE, "Squid Parent: %s process %d exited",
 +                           kid->name().termedBuf(), kid->getPid());
                  }
 -                    syslog(LOG_NOTICE, "Squid Parent: child process %d will not"
+                 if (kid->hopeless()) {
 -                           kid->getPid());
++                    syslog(LOG_NOTICE, "Squid Parent: %s process %d will not"
+                            " be restarted due to repeated, frequent failures",
++                           kid->name().termedBuf(), kid->getPid());
+                 }
              } else {
                  syslog(LOG_NOTICE, "Squid Parent: unknown child process %d exited", pid);
              }
diff --cc src/mem.cc
Simple merge
Simple merge
diff --cc src/protos.h
Simple merge
diff --cc src/store.cc
Simple merge
diff --cc src/structs.h
Simple merge
diff --cc src/tools.cc
Simple merge
diff --cc src/urn.cc
Simple merge