From 9bffc0d975c1a558e5e68c22ab430974b261e0e5 Mon Sep 17 00:00:00 2001 From: Eduard Bagdasaryan Date: Thu, 31 Jul 2025 05:22:56 +0000 Subject: [PATCH] Simplify Ipc::Strand::handleRegistrationResponse() (#2129) Checking PID to ignore stale responses became unnecessary after 2021 commit 4c21861 added Mine() calls that guarantee message freshness. Also replaced the matching kidId check with an assertion because no IPC messages, not even stale ones, may be sent to the kid with the wrong kid identifier. This assertion cannot be easily generalized because most IPC messages do not contain the kid identifier of the intended recipient. --- src/ipc/Strand.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/ipc/Strand.cc b/src/ipc/Strand.cc index 9be97abe48..9d740bbe78 100644 --- a/src/ipc/Strand.cc +++ b/src/ipc/Strand.cc @@ -119,15 +119,9 @@ void Ipc::Strand::receive(const TypedMsgHdr &message) 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()) { - debugs(54, 6, "kid" << KidIdentifier << " registered"); - clearTimeout(); // we are done - } else { - // could be an ACK to the registration message of our dead predecessor - debugs(54, 6, "kid" << KidIdentifier << " is not yet registered"); - // keep listening, with a timeout - } + Assure(KidIdentifier == msg.strand.kidId); + debugs(54, 6, "kid" << KidIdentifier << " registered"); + clearTimeout(); // we are done } void Ipc::Strand::handleCacheMgrRequest(const Mgr::Request& request) -- 2.47.2