/*
- * $Id$
- *
- * DEBUG: section 54 Interprocess Communication
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
+/* DEBUG: section 54 Interprocess Communication */
+
#include "squid.h"
#include "base/Subscription.h"
#include "base/TextException.h"
+#include "CacheManager.h"
+#include "CollapsedForwarding.h"
#include "comm/Connection.h"
+#include "fatal.h"
#include "globals.h"
-#include "ipc/Strand.h"
-#include "ipc/StrandCoord.h"
+#include "ipc/Kids.h"
#include "ipc/Messages.h"
+#include "ipc/QuestionerId.h"
#include "ipc/SharedListen.h"
+#include "ipc/Strand.h"
+#include "ipc/StrandCoord.h"
#include "ipc/StrandSearch.h"
-#include "ipc/Kids.h"
+#include "mgr/Forwarder.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
+#if HAVE_DISKIO_MODULE_IPCIO
#include "DiskIO/IpcIo/IpcIoFile.h" /* XXX: scope boundary violation */
#endif
#if SQUID_SNMP
CBDATA_NAMESPACED_CLASS_INIT(Ipc, Strand);
Ipc::Strand::Strand():
- Port(MakeAddr(strandAddrPfx, KidIdentifier)),
- isRegistered(false)
+ Port(MakeAddr(strandAddrLabel, KidIdentifier)),
+ isRegistered(false)
{
}
debugs(54, 6, HERE);
Must(!isRegistered);
- HereIamMessage ann(StrandCoord(KidIdentifier, getpid()));
- TypedMsgHdr message;
- ann.pack(message);
- SendMessage(coordinatorAddr, message);
+ StrandMessage::NotifyCoordinator(mtRegisterStrand, nullptr);
setTimeout(6, "Ipc::Strand::timeoutHandler"); // TODO: make 6 configurable?
}
void Ipc::Strand::receive(const TypedMsgHdr &message)
{
- debugs(54, 6, HERE << message.type());
- switch (message.type()) {
+ switch (message.rawType()) {
- case mtRegistration:
- handleRegistrationResponse(HereIamMessage(message));
+ case mtStrandRegistered:
+ handleRegistrationResponse(Mine(StrandMessage(message)));
break;
case mtSharedListenResponse:
- SharedListenJoined(SharedListenResponse(message));
+ SharedListenJoined(Mine(SharedListenResponse(message)));
break;
-#if USE_DISKIO_IPCIO
- case mtStrandSearchResponse:
- IpcIoFile::HandleOpenResponse(StrandSearchResponse(message));
+#if HAVE_DISKIO_MODULE_IPCIO
+ case mtStrandReady:
+ IpcIoFile::HandleOpenResponse(Mine(StrandMessage(message)));
break;
case mtIpcIoNotification:
IpcIoFile::HandleNotification(message);
break;
-#endif /* USE_DISKIO_IPCIO */
+#endif /* HAVE_DISKIO_MODULE_IPCIO */
case mtCacheMgrRequest: {
const Mgr::Request req(message);
case mtCacheMgrResponse: {
const Mgr::Response resp(message);
- handleCacheMgrResponse(resp);
+ handleCacheMgrResponse(Mine(resp));
}
break;
+ case mtCollapsedForwardingNotification:
+ CollapsedForwarding::HandleNotification(message);
+ break;
+
#if SQUID_SNMP
case mtSnmpRequest: {
const Snmp::Request req(message);
case mtSnmpResponse: {
const Snmp::Response resp(message);
- handleSnmpResponse(resp);
+ handleSnmpResponse(Mine(resp));
}
break;
#endif
default:
- debugs(54, DBG_IMPORTANT, HERE << "Unhandled message type: " << message.type());
+ Port::receive(message);
break;
}
}
-void Ipc::Strand::handleRegistrationResponse(const HereIamMessage &msg)
+void
+Ipc::Strand::handleRegistrationResponse(const StrandMessage &msg)
{
// handle registration response from the coordinator; it could be stale
if (msg.strand.kidId == KidIdentifier && msg.strand.pid == getpid()) {
if (!isRegistered)
fatalf("kid%d registration timed out", KidIdentifier);
}
+