Closed juzi5201314 closed 2 years ago
Dropping all references to an endpoint and its connections, including any pending futures. should cause the socket to close immediately.
My current solution is to sleep for 3 seconds after Endpoint drop to ensure that the udp socket is closed.
See: https://docs.rs/quinn/latest/quinn/struct.Endpoint.html#method.wait_idle
You can wait on that, and that should be significantly shorter than 3 seconds. :)
It is not necessary to do that, though it is good manners.
Closing for lack of response. Feel free to reopen with details if you're still having trouble with this.
After the endpoint is closed, the udp socket will not be closed immediately.If you start it immediately after closing the server, a port reuse error will occur.
I checked the source code and found that the socket is wrapped in Arc. Does EndpointInner drop after all connections are closed?
I tried calling Endpoint::close, but it didn't work. My current solution is to sleep for 3 seconds after Endpoint drop to ensure that the udp socket is closed.
Is there any way to ensure that the udp socket is closed?