-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
UdpSocket is missing the shutdown method #23194
Comments
I've made an attempt at implementing this that builds, but the information I've found on the matter seems to indicate that shutting down a UDP socket doesn't really make sense. That being said, resources indicate that It's not useful.See step 5: https://www.cs.rutgers.edu/~pxk/417/notes/sockets/udp.html It works.https://msdn.microsoft.com/en-us/library/windows/desktop/ms740481(v=vs.85).aspx |
I think the goal here is a way to terminate a thread that is dedicated to reading from a UDP socket. Currently, recv_from blocks indefinitely and there is no way to signal it to terminate for a clean shutdown. I believe setting Shutdown::Read would cause the currently blocking recv_from to return with an error, which could be handled to implement clean shutdown. There was a similar discussion on #14926 regarding close_read/close_write. I believe the agreement was that Shutdown::Write isn't horribly useful for UDP sockets. Even if you have a dedicated thread for sending out of a UdpSocket, you are more likely to signal termination by dropping the channel which sends data to that thread, rather than shutting down the socket itself. |
I'd like to give this one a try. I have a basic understanding of how UDP works, but I still don't understand where everything is in the source code. |
@aatxe yes as @LorenVS mentioned it may not have the best semantics in all situations, but it definitely does something on supported platforms and we largely want to expose it for symmetry with the TCP primitives. @KiChjang the methods would be added to |
In my experience, simply closing the fd/handle of the socket is enough to cause blocking recv calls to return with a failure (which is different on each platform). This implies that a |
Should be easy enough to implement! Good first bug for anyone and I'd be willing to mentor.
The text was updated successfully, but these errors were encountered: