refactor: Move session stop reason creation into Session constructor - #377
Merged
Conversation
Record the session stop reason before the engine closes the link channels when ending, and derive ConnectionClosed when the session exits because the connection stopped before its stop reason was recorded. Add client-side integration tests covering send/recv/attach surfacing the stop reason on connection stop and session end.
…eason) Move the connection stop-reason cell onto the Connection object (shared with the session, handle, and links, mirroring the session cell) and carry the reason in ConnectionStopped(ConnectionStopReason) on the session error types, following the SessionStopped pattern. AllocSessionError::IllegalState is split into ConnectionNotOpened (not yet opened) and ConnectionStopped (closing or closed). The session engine records the connection stop in its outcome, derives the session stop reason from it, and sanitizes it at the boundary so the session handle still ends cleanly when the connection stops first.
…ardown SessionStopReason and ConnectionStopReason now distinguish a local from a remote-originated stop (EndedWithError/ClosedWithError vs RemoteEnded/ RemoteClosedWithError), with the session reason embedding the connection reason via ConnectionStopped(ConnectionStopReason). The local close-with-error is recorded in the connection cell so links observe it regardless of how the peer responds. Fix two pre-existing teardown bugs surfaced by the new tests: the close exchange drained buffered session frames while the guard only allowed the Opened state, failing the close with IllegalState; and frames arriving in the Discarding state were not discarded per AMQP 2.4.6, poisoning the close outcome. Add origin-differentiation tests (local/remote end and close with error) and clean-teardown tests asserting that local end/close with an error stays clean on the session/connection handle.
Closed
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.
No description provided.