Route cellular perception to its owner
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 39s
Foundation / checks (ecs) (push) Successful in 1m55s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 34s
Foundation / checks (network) (push) Failing after 3m0s
Foundation / checks (client) (push) Failing after 4m27s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-11 01:08:03 -04:00
parent 5419a579e8
commit 27778def2c
8 changed files with 124 additions and 16 deletions
+33 -5
View File
@@ -398,7 +398,8 @@ struct RegionSessions::Impl {
!((config.accept_cellular_intentions &&
c.protocol_version == network::session_protocol_v6) ||
(config.accept_cellular_actions &&
c.protocol_version == network::session_protocol_v7))))
(c.protocol_version == network::session_protocol_v7 ||
c.protocol_version == network::session_protocol_v8)))))
return close(c, SessionCloseReason::protocol, now);
if (const auto* ack = std::get_if<network::SnapshotAck>(&*decoded))
return replication.acknowledge(c.session, *ack);
@@ -560,12 +561,13 @@ 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;
const bool cellular_actions = 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_v7 && !cellular_v7) ||
wire_version > network::session_protocol_v7)
((wire_version == network::session_protocol_v7 ||
wire_version == network::session_protocol_v8) && !cellular_actions) ||
wire_version > network::session_protocol_v8)
return close(c, SessionCloseReason::unsupported_version, now);
} else if (wire_version != c.protocol_version) {
return close(c, SessionCloseReason::unsupported_version, now);
@@ -588,7 +590,8 @@ struct RegionSessions::Impl {
return;
}
if (const auto* m = std::get_if<network::CellularAction>(&*decoded)) {
if (c.protocol_version != network::session_protocol_v7)
if (c.protocol_version != network::session_protocol_v7 &&
c.protocol_version != network::session_protocol_v8)
return close(c, SessionCloseReason::protocol, now);
if (const auto receipt = intents.admit(c.session, *m, admission()))
answer(c, *receipt);
@@ -835,6 +838,31 @@ void RegionSessions::replicate(
m.send_datagram(*c, chunk); // A refused chunk leaves the snapshot unacknowledged.
}
bool RegionSessions::send_cellular_perception(
const network::AccountId& account, const network::CellularPerception& perception) {
auto& m = *impl_;
for (const auto& c : m.connections) {
if (c.state != Impl::State::established || c.protocol_version != network::session_protocol_v8 ||
c.account_id != account)
continue;
return m.endpoint
->send_message(c.id, network::encode_session(perception, c.protocol_version))
.has_value();
}
return false;
}
void RegionSessions::clear_cellular_perceptions(std::uint64_t tick) {
if (tick == 0)
return;
auto& m = *impl_;
const network::CellularPerception cleared{tick, 0, {}};
for (const auto& c : m.connections)
if (c.state == Impl::State::established &&
c.protocol_version == network::session_protocol_v8)
m.send(c, cleared);
}
network::ReplicationStats RegionSessions::replication_stats() const {
return impl_->replication.stats();
}