Skip to content
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

Add Server::max_concurrent_connections(usize) #2094

Open
xmakro opened this issue Dec 12, 2024 · 1 comment
Open

Add Server::max_concurrent_connections(usize) #2094

xmakro opened this issue Dec 12, 2024 · 1 comment

Comments

@xmakro
Copy link

xmakro commented Dec 12, 2024

Add tonic::transport::Server::max_concurrent_connections(limit: usize) which limits the number of concurrent connections that are allowed to be served at the same time. If we reach this limit, then the server will wait until a connection drops before calling .accept() on the socket again.

The change would require guarding the listener.accept() call with a semaphore here and passing the permit of that semaphore to serve_connection here.

I'm happy to make a PR if the contribution is welcome

@xmakro
Copy link
Author

xmakro commented Dec 18, 2024

@tottoto is a PR welcome for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant