Add primitive life calls to the session client
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 2m43s
Foundation / checks (network) (push) Canceled after 39s
Foundation / checks (client) (push) Canceled after 2m49s

This commit is contained in:
dingo
2026-10-10 20:52:32 -04:00
parent 0bb8b50c9c
commit 3277b8f3cd
7 changed files with 193 additions and 56 deletions
+13 -3
View File
@@ -391,7 +391,8 @@ struct RegionSessions::Impl {
std::uint16_t wire_version{};
const auto decoded = network::decode_session(bytes, &wire_version);
if (c.state != State::established || !decoded ||
wire_version != network::session_protocol_version)
wire_version != network::session_protocol_version ||
c.protocol_version != network::session_protocol_version)
return close(c, SessionCloseReason::protocol, now);
if (const auto* ack = std::get_if<network::SnapshotAck>(&*decoded))
return replication.acknowledge(c.session, *ack);
@@ -556,14 +557,21 @@ struct RegionSessions::Impl {
if (const auto* m = std::get_if<network::SessionRefresh>(&*decoded))
return refresh(c, *m, now_seconds, now);
if (const auto* m = std::get_if<network::SessionAction>(&*decoded)) {
if (c.protocol_version == network::session_protocol_v5)
return close(c, SessionCloseReason::protocol, now);
// A durable uniqueness check waits for this poll's single `verify` (M10.9d).
if (const auto receipt = intents.admit(c.session, *m, admission()))
answer(c, *receipt);
return;
}
if (const auto* m = std::get_if<network::ActionQuery>(&*decoded))
if (const auto* m = std::get_if<network::ActionQuery>(&*decoded)) {
if (c.protocol_version == network::session_protocol_v5)
return close(c, SessionCloseReason::protocol, now);
return send(c, intents.query(c.session, *m, admission()));
}
if (const auto* m = std::get_if<network::SessionInterest>(&*decoded)) {
if (c.protocol_version == network::session_protocol_v5)
return close(c, SessionCloseReason::protocol, now);
(void)replication.set_interest(c.session, *m).has_value(); // Clamped by the server.
return;
}
@@ -719,7 +727,9 @@ void RegionSessions::poll(const HostFacts& facts, std::uint64_t now_seconds,
if (auto* c = m.by_session(session); c && c->state == Impl::State::established)
m.answer(*c, receipt);
for (const auto& [session, watermark] : m.intents.simulated(m.admission()))
if (auto* c = m.by_session(session); c && c->state == Impl::State::established)
if (auto* c = m.by_session(session);
c && c->state == Impl::State::established &&
c->protocol_version == network::session_protocol_version)
m.send_datagram(*c, watermark);
for (const auto session : m.control.expire(now_seconds))
if (auto* c = m.by_session(session))