quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Added Endpoint::reject_new_connections #1585

Closed ecton closed 1 year ago

ecton commented 1 year ago

Closes #1584

This commit adds a new function that refuses new connections without impacting existing connections. Internally, this just sets the connection limit to 0, which causes incoming connections to be rejected. This is the same approach that was taken in 0.8.5 when Incoming was dropped.

Let me know if I should also add a unit test to the quinn crate. Since it's a simple pass-through, I elected not to initially.

Ralith commented 1 year ago

Thanks for the PR! Have you tried instead using the existing Endpoint::set_server_config interface to accomplish this in your application?

djc commented 1 year ago

@Ralith maybe we can pass a bool to wait_idle() that takes care of the TransportConfig trick? I agree that the existing method is fairly hard to discover and not very intuitive.

Ralith commented 1 year ago

maybe we can pass a bool to wait_idle()

That doesn't seem very discoverable either, TBH. After discussion I think this is fine.