Handle error replies and harden ESL response parsing#8
Merged
henrikbjorn merged 3 commits intomasterfrom Mar 18, 2026
Merged
Conversation
disconnect called close on the stream from a child fiber, which got interrupted by session_task.stop in the Server ensure block before the FD close completed — no TCP FIN was ever sent. Use close_write (shutdown SHUT_WR) instead, which is an atomic kernel syscall that sends the FIN immediately. The read_loop then sees EOF and exits naturally, letting the Server ensure close the stream from the owning fiber. This matches the pattern used by protocol-http1. Also passes options through Server to listener constructors and adds integration tests using a fake FreeSWITCH over real TCP sockets.
- Add Response#error? predicate for -ERR replies - Raise ResponseError in send_message so callers get error handling - Rescue unhandled errors in run_session to log and end cleanly - URL-decode all content values, not just events (connect replies too) - Sanitize header names to valid symbol chars (gsub non-alphanumeric) - Suppress Ruby experimental IO::Buffer warning in tests
c960657
approved these changes
Mar 18, 2026
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
Response#error?predicate andResponseErrorexception for-ERRrepliessend_messageraises on error replies so callers don't silently swallow failures (fixesapplicationhanging forever on-ERR)run_sessionrescues unhandled errors and logs them — session ends cleanly