feat: Add support for simultaneous TCP and UDS binding#805
Open
IngmarStein wants to merge 1 commit intoemmett-framework:masterfrom
Open
feat: Add support for simultaneous TCP and UDS binding#805IngmarStein wants to merge 1 commit intoemmett-framework:masterfrom
IngmarStein wants to merge 1 commit intoemmett-framework:masterfrom
Conversation
This commit enables Granian to serve on both TCP sockets and Unix Domain Sockets concurrently. Changes: - Updated Rust worker implementations (ASGI, RSGI, WSGI) to handle optional dual listeners. - Enhanced `WorkerConfig` to store both TCP and UDS socket holders. - Introduced new `serve_*_dual` macros and functions in Rust to manage concurrent listeners using `tokio::join!`. - Modified Python `cli.py` to allow both `--host` and `--uds` arguments to be specified. - Updated `AbstractServer` and server implementations (MP, MT) to initialize and pass both sockets to workers. - Added a new test case `tests/test_dual_socket.py` to verify simultaneous connectivity. - Updated `granian/_granian.pyi` type stubs to reflect the changes in worker constructors.
Member
|
@IngmarStein can you expand on the use-case for this? While I get what this is about, I don't really get the why we would want this. |
Contributor
Author
|
@gi0baro sorry about this, I should have linked to #97 (comment) as the motivation for the PR! |
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.
This commit enables Granian to serve on both TCP sockets and Unix Domain Sockets concurrently.
Changes:
WorkerConfigto store both TCP and UDS socket holders.serve_*_dualmacros and functions in Rust to manage concurrent listeners usingtokio::join!.cli.pyto allow both--hostand--udsarguments to be specified.AbstractServerand server implementations (MP, MT) to initialize and pass both sockets to workers.tests/test_dual_socket.pyto verify simultaneous connectivity.granian/_granian.pyitype stubs to reflect the changes in worker constructors.