fix: send session_end notification before wipe/close (#6)#14
Open
fix: send session_end notification before wipe/close (#6)#14
Conversation
- Add 'end' wire message type sent to peer before shutdown - Handle incoming 'end' messages in receive_loop to cleanly close session - Both close_session and panic_wipe now notify peer before destroying state - Peer receives session_closed event with reason='peer_ended' Co-Authored-By: Oz <oz-agent@warp.dev>
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.
Fix: Send session_end notification before wipe/close
Closes #6
Problem
When a user triggers
panic_wipe()orclose_session(), the local session is shut down but the peer receives no protocol-level notification. This creates an asymmetric state where one side thinks the session is active while the other has already destroyed it.Solution
"end"wire message type to the protocolclose_sessionanddo_panic_wipenow send a{"t":"end"}frame to the peer before shutting down the stream writerreceive_loop/handle_incoming_messagenow recognizes"end"messages and:session_closedwithreason: "peer_ended"to the frontendSecurity considerations
"end"message is sent as a best-effort signal — if the I2P tunnel is already broken, the send may fail silently, which is acceptable since the stream will eventually error out on the peer side"end"frameThis PR was generated with Oz.