]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/Strand.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / Strand.cc
index 4d7bf6def351bff5ef29c1befaa0b31f9ca5bd3f..3bd7b2c23971f2b32ff24ae87d198a8ae7be8c75 100644 (file)
@@ -5,17 +5,25 @@
  *
  */
 
-#include "config.h"
+#include "squid.h"
+#include "base/Subscription.h"
 #include "base/TextException.h"
+#include "comm/Connection.h"
+#include "globals.h"
 #include "ipc/Strand.h"
 #include "ipc/StrandCoord.h"
 #include "ipc/Messages.h"
 #include "ipc/SharedListen.h"
+#include "ipc/StrandSearch.h"
 #include "ipc/Kids.h"
 #include "mgr/Request.h"
 #include "mgr/Response.h"
 #include "mgr/Forwarder.h"
+#include "SwapDir.h" /* XXX: scope boundary violation */
 #include "CacheManager.h"
+#if USE_DISKIO_IPCIO
+#include "DiskIO/IpcIo/IpcIoFile.h" /* XXX: scope boundary violation */
+#endif
 #if SQUID_SNMP
 #include "snmp/Forwarder.h"
 #include "snmp/Request.h"
@@ -24,7 +32,6 @@
 
 CBDATA_NAMESPACED_CLASS_INIT(Ipc, Strand);
 
-
 Ipc::Strand::Strand():
         Port(MakeAddr(strandAddrPfx, KidIdentifier)),
         isRegistered(false)
@@ -41,8 +48,10 @@ void Ipc::Strand::registerSelf()
 {
     debugs(54, 6, HERE);
     Must(!isRegistered);
+
+    HereIamMessage ann(StrandCoord(KidIdentifier, getpid()));
     TypedMsgHdr message;
-    StrandCoord(KidIdentifier, getpid()).pack(message);
+    ann.pack(message);
     SendMessage(coordinatorAddr, message);
     setTimeout(6, "Ipc::Strand::timeoutHandler"); // TODO: make 6 configurable?
 }
@@ -53,13 +62,23 @@ void Ipc::Strand::receive(const TypedMsgHdr &message)
     switch (message.type()) {
 
     case mtRegistration:
-        handleRegistrationResponse(StrandCoord(message));
+        handleRegistrationResponse(HereIamMessage(message));
         break;
 
     case mtSharedListenResponse:
         SharedListenJoined(SharedListenResponse(message));
         break;
 
+#if USE_DISKIO_IPCIO
+    case mtStrandSearchResponse:
+        IpcIoFile::HandleOpenResponse(StrandSearchResponse(message));
+        break;
+
+    case mtIpcIoNotification:
+        IpcIoFile::HandleNotification(message);
+        break;
+#endif /* USE_DISKIO_IPCIO */
+
     case mtCacheMgrRequest: {
         const Mgr::Request req(message);
         handleCacheMgrRequest(req);
@@ -87,15 +106,15 @@ void Ipc::Strand::receive(const TypedMsgHdr &message)
 #endif
 
     default:
-        debugs(54, 1, HERE << "Unhandled message type: " << message.type());
+        debugs(54, DBG_IMPORTANT, HERE << "Unhandled message type: " << message.type());
         break;
     }
 }
 
-void Ipc::Strand::handleRegistrationResponse(const StrandCoord &strand)
+void Ipc::Strand::handleRegistrationResponse(const HereIamMessage &msg)
 {
     // handle registration response from the coordinator; it could be stale
-    if (strand.kidId == KidIdentifier && strand.pid == getpid()) {
+    if (msg.strand.kidId == KidIdentifier && msg.strand.pid == getpid()) {
         debugs(54, 6, "kid" << KidIdentifier << " registered");
         clearTimeout(); // we are done
     } else {