-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend Server to use anything that produces a stream of (Io, SocketAddr) #1045
Conversation
* Add bind_existing method to allow the creation of a server that uses an existing tcplistener instead of the one created by hyper
* Generalize the Server struct so that it can be handed a stream of Io implementors.
Thanks for contributing! Unfortunately, I'm here to tell you there were the following style issues with your Pull Request:
Guidelines are available at https://github.com/hyperium/hyper/blob/master/CONTRIBUTING.md This message was auto-generated by https://gitcop.com |
Being generic over a stream of The idea is that Making use of TLS for the Server just involves using @alexcrichton may have more thoughts on the matter. |
I tried getting that working first (https://play.rust-lang.org/?gist=d8d0d1ed14574f4085b1d663c6354ef8&version=stable&backtrace=0), but it seemed to be missing some implementation (I think: #1036). I was going to add that, but then I noticed that tokio-proto didn't have graceful shutdown, which is something I wanted, so I did this. Is there something I've missed? |
@mattwoodyard sounds like you went down the same rabbit hole I did! @seanmonstar is spot on in that the server Hyper bundles isn't currently intended to be used with TLS (or other protocols for that matter). The idea is that protocols are built externally and then there's generic support for taking a protocol and spinning up a server with it. Note, though, that support isn't quite here yet for all that. PRs like tokio-rs/tokio-proto#135 and issues like #1036 are key ingredients to getting that working. With #1036 Hyper's request/response should work "as-is" with tokio-proto's @seanmonstar I'll leave it up to you whether you'd like to merge this for now. The intention at least is that this shouldn't be necessary (and in fact, the entire server shouldn't be necessary!), so you can at least rest easy that in the future you won't have to maintain this :) |
Oh right, what I had suggested doesn't actually work yet without #1036. With #1036 fixed, would that solve your use case @mattwoodyard? |
For my immediate task, I'm just trying to get TLS to work. I'm not particularly attached to the approach in this PR. If #1036 can make the tokio_tls stuff work, thats fine. Longterm I'd like graceful shutdown with my TLS. If the plan is to generalize the hyper approach into tokio-proto, I can take a swing at that. |
Yeah I believe that's the general long term plan at least, to have Hyper work well with the tokio-proto server builders to leverage all of the logic in there (which will expand over time) |
Closing in favor of #1047 |
I've done some refactoring on Server to make it easier to integrate with and ssl listener.