3.3.0: let the caller say when a server stops - #57
Merged
Merged
Conversation
added 2 commits
September 23, 2026 11:49
listen() claimed SIGTERM and SIGINT for the whole process, and nagoya allows one waiter per signal number, so a second server in the same process failed with EBUSY after it had bound its port. Its listener was dropped and a client connecting to that port waited forever. Any process that serves twice hits it, and every test harness that starts a server per test does: agency-proxy's WebSocket suite hung on exactly this. listen_until takes the stop condition as a future and registers no signal. listen() is unchanged and delegates to it with the process signals, so current callers keep their behaviour. The one stop future is now polled across loop iterations rather than rebuilt each time, so a caller's future is never dropped half-way.
Adds WebsocketServer::listen_until.
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.
Releases 3.3.0.
WebsocketServer::listen()claimed SIGTERM and SIGINT for the whole process. nagoya allows one waiter per signal number, so a second server in the same process failed withEBUSYafter binding its port; the listener was dropped and a client connecting to it waited forever. agency-proxy's WebSocket test suite hung on this: each test passes alone, and the second server in one process never answers.listen_until(stop): stops whenstopresolves, registers no signal. For a process that owns its own signals or runs more than one server.listen()is unchanged for callers: it delegates to the same path with the process signals.Checked:
cargo test --all-features,scripts/check-features.sh(every feature compiles standalone).check-chain.shnot run: this adds API and changes no existing signature.Downstream: agency-proxy 0.1.11 needs
^3.3for this.