-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Enable reuse_port(true) in easy way #219
Comments
I don't think this is a supported feature in hyper currently, so I think if we want this to be added to May I ask what is tedious about using the method that is in the |
Fair enough, will do it
If I got it correctly, we need to implement |
So you can use tokio's tcp stream type which implements those traits. I would suggest using the tokio tcplistener, and set the options you want. https://docs.rs/tokio/0.2.8/tokio/net/struct.TcpListener.html#method.incoming this should then create a stream of tcpstreams that should align with the incoming types for tonic. |
Right, thats what I am basically doing. But also what I need to do is to add a new datatype:
So I am just duplicating code from uds example. |
@michael-a-cliqz there is, I forgot to add a impl for I'd accept a PR that does this for |
Feature Request
Crates
tonic
Motivation
We are trying to build multithreaded server, where each thread is supposed to run following code snippet:
But as long as all our threads share same address, it doesn't work.
Now this could be done by using
net2::TcpBuilder::reuse_port(true)
and then passing produced listener toServer::builder()::serve_with_incoming()
, just like uds example does.Unfortunately, this approach is too tedious for controlling single socket option. It would be nice to have some friendly interface instead.
The text was updated successfully, but these errors were encountered: