Wire M10.8c-1 region handoff: protocol v4, durable probes, crossing, ghosts
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
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 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s
Foundation / checks (deploy) (push) Successful in 3m29s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m51s
Foundation / checks (network) (push) Successful in 13m0s
Foundation / checks (tsan) (push) Successful in 7m50s
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 32m4s
Foundation / checks (postgres) (push) Canceled after 19m13s
ADR-0096. Session protocol v4 (v3 is deployed and frozen) adds HandoffOffer, SessionRedirect, close reasons handed_off and moved, and ghost marker records. Sessions use the durable probe record: logins open it where it was saved (redirected when it lives elsewhere), and session ends save it. A marker crossing into a neighbour's area is frozen, prepared, its control released and a signed ticket offered; uncommitted transfers are aborted after the ticket's lifetime. The destination shows arriving probes as ghosts (schema v13 incoming_probe_transfers) and opens the marker where it crossed. Refreshes the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,9 @@ struct RegionSessionClient::Impl {
|
||||
std::vector<network::ActionOutcome> action_outcomes;
|
||||
std::optional<network::SnapshotAssembler> snapshots;
|
||||
std::uint64_t snapshot_chunks{}, snapshot_bytes{};
|
||||
static constexpr std::size_t max_kept = 1024; // Per kind, until taken; oldest dropped.
|
||||
std::optional<network::HandoffOffer> handoff; // v4: continue at another region.
|
||||
std::optional<network::RegionAddress> redirect; // v4: the probe is owned elsewhere.
|
||||
static constexpr std::size_t max_kept = 1024; // Per kind, until taken; oldest dropped.
|
||||
|
||||
template <typename T> static void keep(std::vector<T>& list, const T& item) {
|
||||
if (list.size() >= max_kept)
|
||||
@@ -95,6 +97,10 @@ struct RegionSessionClient::Impl {
|
||||
if (const auto* m = std::get_if<network::SessionClose>(&*decoded))
|
||||
return end(m->reason, false);
|
||||
if (state == RegionSessionState::awaiting_welcome) {
|
||||
if (const auto* m = std::get_if<network::SessionRedirect>(&*decoded)) {
|
||||
redirect = m->owner; // A Close (moved) follows.
|
||||
return;
|
||||
}
|
||||
if (const auto* m = std::get_if<network::SessionWelcome>(&*decoded)) {
|
||||
welcome = *m;
|
||||
snapshots.emplace(world::WorldIdentity{m->world, m->frame}, m->epoch);
|
||||
@@ -115,6 +121,10 @@ struct RegionSessionClient::Impl {
|
||||
}
|
||||
if (const auto* m = std::get_if<network::ActionOutcome>(&*decoded))
|
||||
return keep(action_outcomes, *m);
|
||||
if (const auto* m = std::get_if<network::HandoffOffer>(&*decoded)) {
|
||||
handoff = *m; // A Close (handed_off) follows.
|
||||
return;
|
||||
}
|
||||
}
|
||||
end(SessionCloseReason::protocol, true);
|
||||
}
|
||||
@@ -258,6 +268,14 @@ std::uint64_t RegionSessionClient::snapshot_bytes() const noexcept {
|
||||
return impl_->snapshot_bytes;
|
||||
}
|
||||
|
||||
std::optional<network::HandoffOffer> RegionSessionClient::take_handoff() {
|
||||
return std::exchange(impl_->handoff, std::nullopt);
|
||||
}
|
||||
|
||||
const std::optional<network::RegionAddress>& RegionSessionClient::redirect() const noexcept {
|
||||
return impl_->redirect;
|
||||
}
|
||||
|
||||
RegionSessionState RegionSessionClient::state() const noexcept {
|
||||
return impl_->state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user