Relay Upstream Reconnect#42
Merged
maxholman merged 3 commits intoblock65:mainfrom Feb 28, 2026
Merged
Conversation
The relay now uses connect_loop instead of connect_with_retry, so when the source peer connection drops the relay tears down the listener, reconnects, and restarts. Connected peers reconnect via their own retry loops. Uses ConnectionTasks::wait_for_disconnect() in a tokio::select! to detect source peer death — matching the exit node pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Introduces three quality-of-life improvements: 1. SocketAddrExt trait: Replaces free function normalize_socket_addr() with addr.normalize() method on SocketAddr. 2. From implementations: Replaces proto conversion helper functions (node_role_to_proto, peer_to_proto, route_to_proto, peer_event_to_proto) with standard From<T> impls for ergonomic .into() usage. 3. AsyncProtoRead/AsyncProtoWrite traits: Moves length-delimited protobuf reading/writing into extension traits on AsyncRead/AsyncWrite streams. Replaces verbose calls with stream.read_proto::<T>(mtu) and stream.write_proto(&msg). These changes eliminate custom function names in favor of idiomatic Rust patterns per C-METHOD guidelines, improving discoverability and reducing API surface area. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ethods Moves the massive control loop and connection handler into idiomatic methods on their respective structs: - ControlChannels::run: The control loop is now a method on the channel struct instead of a standalone function. Includes a helper handle_message method to break down the monolithic control matching. Removes the clippy::too_many_lines suppression. - ConnectionParams::run: The entry node's connection handler is now an idiomatic method. Resolves complex borrow-checker issues by destructuring self and using standalone helper functions for data tasks and the main loop. Follows the C-METHOD guidelines and improves testability. All clippy::too_many_arguments and clippy::too_many_lines suppressions related to these functions have been removed. The architecture is now more modular and follows Rust API Guidelines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced May 6, 2026
maxholman
added a commit
that referenced
this pull request
May 6, 2026
Closes 8 open dependabot alerts via transitive lockfile bumps: - rustls-webpki 0.103.9 -> 0.103.13 — CRL/URI/wildcard name-constraint handling and panic-on-malformed-CRL DoS (alerts #27 #42 #43 #47) - rand 0.8.5 -> 0.8.6 and 0.9.2 -> 0.9.4 — soundness fix for callers using a custom logger with rand::rng() (#45 #46) - h3 1.15.8 -> 1.15.11 (website) — path traversal via double-decoded %252e%252e in serveStatic and SSE event injection via unsanitized carriage return (#24 #25) No direct dependency edits; all bumps are transitive.
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.
Relay Upstream Reconnect
Scope
crates/daemon/src/mode/relay.rs— add a reconnect loop around the upstreamconnection so the relay recovers when its upstream peer drops.
Out of scope
Why
The relay connects to its upstream peer once, extracts the channel pair, then
runs the listener loop forever against those channels. If the upstream drops,
the channels go dead but the listener keeps running — downstream peers remain
connected and silently receive nothing. The relay never attempts to reconnect.
This is a hard blocker for Phase 13c (auto-negotiation), which assumes ordering
independence and relay resilience.
Notes
connect_with_retryalready exists incrates/daemon/src/transport.rs— use itDownstream peers will see a transport drop and reconnect via their own retry
loops. This is acceptable — full session continuity across upstream reconnects
is Phase 13b scope.
connect_with_retry), not return an error.behaviour.
verifies the relay re-establishes the connection.
just checkmust pass before review.