-
Notifications
You must be signed in to change notification settings - Fork 2
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
expose tokio::net::tcp_listener
?
#12
Comments
Hm. Not sure I agree with this. I can see how this might come in handy, but I have two questions:
I think my main issue with this is that it is very specific to Hyper. If it were easier in hyper to use an existing socket, we wouldn't need this. In actix-web, e.g., you can pretty much to |
Yeah I actually agree with this. Good point. |
Hmmm, on the other hand it would become harder to configure socket things like keepalive durations and the like. hyperium/hyper#1602 (comment) edit: actually it looks like most options can be set on core's References |
|
In #11 we're adding an example of how to use this crate with the Hyper HTTP server. To get it to work, some glue is required:
This seems like boilerplate that would probably be copy-pasted from between projects, which makes it seem like a prime candidate to create a method for.
I was thinking something like this:
The name here could probably use some work (cc/ @killercup, suggestions?) but I reckon the result would be really useful.
Setting up a complete HTTP server would then only require the following:
Which I think is starting to become short enough that people can memorize it!
Drawbacks
This would add
tokio
as a dependency which adds a bit of overhead during compilation. But given that all major frameworks depend on it, it's probably safe to say it won't introduce any new dependencies for production systems.The text was updated successfully, but these errors were encountered: