Enable durable cellular session actions
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 37s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (postgres) (push) Failing after 50s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (network) (push) Canceled after 2m38s
Foundation / checks (tsan) (push) Canceled after 22s
Foundation / checks (client) (push) Canceled after 3m18s

This commit is contained in:
dingo
2026-10-10 23:31:36 -04:00
parent 0ddba31d42
commit eeb663d696
7 changed files with 179 additions and 15 deletions
+33 -9
View File
@@ -323,9 +323,11 @@ struct RegionSessions::Impl {
intents.close(c.session);
return close(c, SessionCloseReason::capacity, now);
}
if (default_interest && c.protocol_version != network::session_protocol_v6)
if (default_interest && c.protocol_version != network::session_protocol_v6 &&
c.protocol_version != network::session_protocol_v7)
(void)replication.set_interest(c.session, *default_interest).has_value();
if (markers.area() && c.protocol_version != network::session_protocol_v6)
if (markers.area() && c.protocol_version != network::session_protocol_v6 &&
c.protocol_version != network::session_protocol_v7)
// Full or refused: the session simply has no marker.
(void)(c.probe ? markers.open_at(c.session, c.probe->x, c.probe->y)
: markers.open(c.session))
@@ -394,8 +396,10 @@ struct RegionSessions::Impl {
const auto decoded = network::decode_session(bytes, &wire_version);
if (c.state != State::established || !decoded || wire_version != c.protocol_version ||
(c.protocol_version != network::session_protocol_version &&
!(config.accept_cellular_intentions &&
c.protocol_version == network::session_protocol_v6)))
!((config.accept_cellular_intentions &&
c.protocol_version == network::session_protocol_v6) ||
(config.accept_cellular_actions &&
c.protocol_version == network::session_protocol_v7))))
return close(c, SessionCloseReason::protocol, now);
if (const auto* ack = std::get_if<network::SnapshotAck>(&*decoded))
return replication.acknowledge(c.session, *ack);
@@ -406,6 +410,8 @@ struct RegionSessions::Impl {
send_datagram(c, intents.intention(c.session, *m, admission()));
return;
}
if (c.protocol_version == network::session_protocol_v7)
return close(c, SessionCloseReason::protocol, now); // No M10 datagrams in v7.
const auto* m = std::get_if<network::SessionIntention>(&*decoded);
if (!m)
return close(c, SessionCloseReason::protocol, now);
@@ -525,6 +531,7 @@ struct RegionSessions::Impl {
if (receipt.status == network::AdmitStatus::duplicate)
if (const auto o = intents.query(c.session, {receipt.action_id}, admission());
o.result == network::ActionResult::committed_no_effect ||
o.result == network::ActionResult::committed ||
o.result == network::ActionResult::not_committed)
send(c, o);
}
@@ -554,10 +561,12 @@ struct RegionSessions::Impl {
c.protocol_version = wire_version;
const bool primitive_v5 = static_cast<bool>(config.create_primitive_life);
const bool cellular_v6 = config.accept_cellular_intentions;
const bool cellular_v7 = config.accept_cellular_actions;
if ((primitive_v5 && wire_version != network::session_protocol_v5) ||
(wire_version == network::session_protocol_v5 && !primitive_v5) ||
(wire_version == network::session_protocol_v6 && !cellular_v6) ||
wire_version > network::session_protocol_v6)
(wire_version == network::session_protocol_v7 && !cellular_v7) ||
wire_version > network::session_protocol_v7)
return close(c, SessionCloseReason::unsupported_version, now);
} else if (wire_version != c.protocol_version) {
return close(c, SessionCloseReason::unsupported_version, now);
@@ -571,13 +580,21 @@ struct RegionSessions::Impl {
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 ||
c.protocol_version == network::session_protocol_v6)
c.protocol_version == network::session_protocol_v6 ||
c.protocol_version == network::session_protocol_v7)
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::CellularAction>(&*decoded)) {
if (c.protocol_version != network::session_protocol_v7)
return close(c, SessionCloseReason::protocol, now);
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 (c.protocol_version == network::session_protocol_v5 ||
c.protocol_version == network::session_protocol_v6)
@@ -586,7 +603,8 @@ struct RegionSessions::Impl {
}
if (const auto* m = std::get_if<network::SessionInterest>(&*decoded)) {
if (c.protocol_version == network::session_protocol_v5 ||
c.protocol_version == network::session_protocol_v6)
c.protocol_version == network::session_protocol_v6 ||
c.protocol_version == network::session_protocol_v7)
return close(c, SessionCloseReason::protocol, now);
(void)replication.set_interest(c.session, *m).has_value(); // Clamped by the server.
return;
@@ -630,6 +648,9 @@ RegionSessions::create(RegionSessionsConfig config) {
((config.create_primitive_life || config.query_primitive_life) &&
(!config.create_primitive_life || !config.query_primitive_life || !config.ledger)) ||
(config.accept_cellular_intentions && config.create_primitive_life) ||
(config.accept_cellular_actions &&
(!config.actions || !config.ledger || config.create_primitive_life ||
config.accept_cellular_intentions)) ||
config.transport.limits.max_connections < config.control.max_sessions ||
config.hello_deadline.count() <= 0 || config.close_flush.count() <= 0 ||
config.renew_interval.count() <= 0 || config.safety_margin.count() <= 0 ||
@@ -789,6 +810,7 @@ void RegionSessions::set_default_interest(network::SessionInterest interest) {
for (const auto& c : m.connections)
if (c.state == Impl::State::established &&
c.protocol_version != network::session_protocol_v6 &&
c.protocol_version != network::session_protocol_v7 &&
!m.replication.interest(c.session))
(void)m.replication.set_interest(c.session, interest).has_value();
}
@@ -812,7 +834,8 @@ void RegionSessions::replicate(
for (const auto& [session, chunks] : m.replication.tick(tick, with_markers, perceives, payload))
if (const auto* c = m.by_session(session);
c && c->state == Impl::State::established &&
c->protocol_version != network::session_protocol_v6)
c->protocol_version != network::session_protocol_v6 &&
c->protocol_version != network::session_protocol_v7)
for (const auto& chunk : chunks)
m.send_datagram(*c, chunk); // A refused chunk leaves the snapshot unacknowledged.
}
@@ -838,7 +861,8 @@ bool RegionSessions::set_motion_area(const network::motion::Area& area, std::int
m.spawn_y = std::clamp(spawn_y, area.min_y, area.max_y);
for (const auto& c : m.connections)
if (c.state == Impl::State::established &&
c.protocol_version != network::session_protocol_v6 && !m.markers.of(c.session))
c.protocol_version != network::session_protocol_v6 &&
c.protocol_version != network::session_protocol_v7 && !m.markers.of(c.session))
(void)m.markers.open(c.session).has_value();
return true;
}