feat(core): launch on a caller-supplied Listener - #1
Open
jadidbourbaki wants to merge 1 commit into
Open
Conversation
`launch` can only use the transports Rocket ships with, so an application with its own TLS stack has no way to serve through Rocket. Add `Rocket::launch_with_listener`, which takes any `Listener` and runs the same ignite-then-serve sequence `launch` does, liftoff fairings included, then hands the listener to the accept loop. This also makes `http_server` public, which is the "make this function public" half of the TODO already sitting above it. `default_tcp_http_server` is untouched and remains the built-in path.
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.
Rocket's
launchcan only use the transports it ships with, TCP and rustls. An application that brings its own TLS stack therefore has no way to serve through Rocket at all. I hit this driving fizz-rs TLS in the Tahini benchmarks, and worked around it by vendoring a patched copy of your fork, which I would rather not keep doing. This addsRocket::launch_with_listener, which accepts anyListenerand runs the same sequencelaunchdoes: ignite if the instance is still building, run liftoff fairings, log the launch, then hand the listener to the accept loop. It also makeshttp_serverpublic, which is the "make this function public" half of the TODO already sitting above that function;default_tcp_http_serveris untouched and stays the built-in path, so nothing about existing behavior changes. My motivation is a follow-up in Sesame: sesame_rocket'sSesameRocketneeds a matching wrapper so Sesame applications can pass a listener through, and that wrapper can only exist once the underlying Rocket exposes this. With both in place I can drop two vendored trees and depend on your fork directly.