Repository navigation
fix(relay): reopen paths when disabled relays are re-enabled or re-inserted - #23
Merged
Merged
Conversation
…ay reinsert Shelve per-remote disabled relay addresses inside RemotePathState instead of erasing them so Endpoint::set_disabled_relays re-enables and reopens client paths immediately without redialing or address lookup. Serialize RelayMap, RelayPolicies::removed tombstones, RelayActor, and RemoteMap updates inside socket::Actor for Endpoint::remove_relay and Endpoint::insert_relay: - close established and opening paths on remove_relay without falling back to another transport in TransportsSender::poll_send; - settle one unit of relay_lost and relay_lost_total when canceling an unestablished opening relay path so RELAY_CONN_LOST_MAX (6) still protects MAX_MULTIPATH_PATHS (8) for non-relay transports; - track inserted relays in socket::Actor::reopen_on_connect so insert_relay clears per-relay relay_lost and reopens paths (including when already connected or across coalesced watch updates) while leaving ordinary home-relay reconnects unchanged; - clarify first-comparison entrance switch wording in STILLFAIL.md and add exact 50->40 ms / 30->20 ms boundary cases in ActiveRelayActor tests. Co-authored-by: darksky <darksky@cue.surf>
CommaBot
force-pushed
the
ember/relay-policy-reopen
branch
from
November 20, 2026 19:13
88e2211 to
f02c469
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Endpoint::set_disabled_relays,ConnectOptions::with_disabled_relays):RemotePathState::shelved_relaysinstead of permanently deleting them frompaths, while keepingallowlistas an immutable ceiling.set_disabled_relaysshrinks a remote's disabled set, restores newly allowed shelved relays intopaths, clears their per-relayrelay_lostcounter (bounded byRELAY_CONN_LOST_MAX = 6), and immediately callsreopen_relay_paths()on client connections without redialing or address lookup.Endpoint::remove_relay/Endpoint::insert_relaylifecycle & transport isolation:relay_map.{remove, insert}andrelay_policies.set_removedmutations intosocket::Actor::handle_actor_messagealongsidetransports_network_changeandremote_map, eliminating concurrent insert/remove tombstone races (Astra P1 relay: a packet that waited 200 ms in a client's queue is dropped #1).TransportsSender::poll_sendpositionindex lookup so packets addressed to a removed or unconfigured relay transport never fall back to the default IP/custom transport.relay_lostandrelay_lost_totalwhenState::close_forbidden_pathscancels an unestablished path still inconn_state.relay_opening, preservingMAX_MULTIPATH_PATHS(8) headroom for non-relay (Ip/Custom) paths across repeated blackhole churn (Astra P1 Choose the path again as its RTTs change, not only as paths come and go #2).socket::Actor::reopen_on_connectsoRelayConnectedonly clears per-relayrelay_lostand reopens client paths forinsert_relay(including when the relay is alreadyConnectedwith zero watch state diff or across back-to-backremove_relay+insert_relaywatch coalescing), keeping ordinary home-relay reconnects 100% unchanged.STILLFAIL.mdthatActiveRelayActor::choose_entryswitches immediately on the first comparison after startup /update_entriesand requires two consecutive rounds thereafter.50 ms -> 40 ms(rejected at exact 20%) and30 ms -> 20 ms(accepted at exact 10 ms) boundary assertions inchoose_entry_requires_both_min_gain_and_relative_margin.Boundary &
station/native/meshImpactsocket.rs:1477-1480,Endpoint::relay_datagramscounts datagrams admitted pastRelayPolicies::usableinto the relay transport channel;ActiveRelayHandle::stopaborts the active relay task immediately onremove_relay, dropping any un-flushed channel items before wire write while closing QUIC paths synchronously inRemoteStateActor.station/native/meshimpact:reopen_on_connectis populated exclusively byActorMessage::RelayInserted, so backgroundActiveRelayActorreconnects do not triggeron_relay_connectedor resetrelay_lost.set_disabled_relays:shelved_relaysonly stores addresses already bounded byRemotePathState(MAX_ADDRS/ peerEndpointAddrrelays) and removes entries when re-enabled or when theRemoteStateActoridles out (60 s).remove_relay/insert_relay: Actor wait graph is a strict DAG (socket::Actor -> RelayActor -> ActiveRelayActorandsocket::Actor -> RemoteStateActor, with zero reverse.awaitedges).