From: Eduard Bagdasaryan Date: Thu, 31 Jul 2025 05:22:56 +0000 (+0000) Subject: Simplify Ipc::Strand::handleRegistrationResponse() (#2129) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bffc0d975c1a558e5e68c22ab430974b261e0e5;p=thirdparty%2Fsquid.git 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. --- 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)