Repository navigation
firmware: on the Relay's unlinked, end only the computer's link - #146
Merged
Merged
Conversation
`unlinked` from the Relay means the computer linked through it is gone (takeover, the computer dropped, unpaired); the box's socket stays open. RelayBox handled it like a closed socket: it marked the Relay down and reset itself, so the NETWORK view read "DOWN" and the box stopped reporting pairing and USB/LAN changes until its next welcome. Now it ends the computer's link and keeps welcomed, the reported state and relay_up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
RelayBox::messagehandled{"t":"unlinked"}by callinggone(), which is meant for the socket closing. Per docs/relay-protocol.md,unlinkedto the box only ends the link of the computer linked through the Relay (gone,released,unpaired, takeover); the socket stays open. After such an unlink:welcomedwas cleared, soreport()sent nothing until the nextwelcome: the Relay stopped hearing about pairing changes and USB/LAN links (e.g. a computer plugging in, which the Relay needs to know to refuse other links).relay_upwent false, so the NETWORK view showed the Relay asDOWNwhile the socket was up.(The link mark is unaffected: it doesn't read
relay_up, and the Relay link has ended anyway.)Fix
On
unlinked, callfirmware.relay_linked(now, None)and droppeer; keepwelcomed, the reported state andrelay_up.gone()stays for the socket closing.If #144 (Noise sessions) lands first, this arm should also drop the Noise session and call
board.relay_peer(None); whichever merges second picks that up.Tests
New
relay::unlinked_ends_only_the_computers_link: afterunlinked, the NETWORK view still showsPROD(plain), and pairing a second computer over the cable is reported (paired+linked via usb). It failed before the fix (PROD DOWN).cargo testin firmware-rs/core passes; the device crate builds (cargo check --release). Not tried on the box.🤖 Generated with Claude Code