]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Simplify Ipc::Strand::handleRegistrationResponse() (#2129)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Thu, 31 Jul 2025 05:22:56 +0000 (05:22 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Thu, 31 Jul 2025 21:46:10 +0000 (09:46 +1200)
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

index 9be97abe4801133e2aca8615b274d8e4585bb2e9..9d740bbe78e5d41e019442bd982e2f37b0aff164 100644 (file)
@@ -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)