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

closing server sockets #92

Open
brandon-reinhart opened this issue Sep 22, 2022 · 2 comments
Open

closing server sockets #92

brandon-reinhart opened this issue Sep 22, 2022 · 2 comments
Labels
bug needs fixing feature desired new functionality naia socket pertaining to naia_socket crates naia pertaining to naia crates

Comments

@brandon-reinhart
Copy link

It doesn't appear that there's a way to shutdown or stop listening to a port once it's started? The server API has listen, but no way to close. Dropping the server resource doesn't seem to release the socket/port. What's the expected way to shutdown a bevy server resource?

@brandon-reinhart
Copy link
Author

Looks like socket::listen detaches the executors but doesn't hold onto the channels. So if you want to close a socket, you'd want to close the channels. Then the executor should check if the channels are closed (or recv is in error re: closed channels) and end the loop and die. The channels could be closed externally, thereby resulting in a shutdown.

Shutdown is async, so there'd also be a need to check that the shutdown is complete and the port is available before rebinding it at some point later...

Is this a correct reading?

@connorcarpenter connorcarpenter added naia socket pertaining to naia_socket crates naia pertaining to naia crates bug needs fixing feature desired new functionality labels Mar 20, 2023
@connorcarpenter connorcarpenter changed the title Bevy - Server shutdown? Be able to shut down server and actually close underlying sockets Mar 20, 2023
@connorcarpenter
Copy link
Member

Yep this feature is definitely needed, there's no way to cleanly shut down a server and clean up it's listening ports / resources. I've been relying on the OS to do that after stopping the running process. Thanks again for this 🙏

@connorcarpenter connorcarpenter changed the title Be able to shut down server and actually close underlying sockets Be able to actually close underlying sockets Jan 10, 2024
@connorcarpenter connorcarpenter changed the title Be able to actually close underlying sockets closing server sockets Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs fixing feature desired new functionality naia socket pertaining to naia_socket crates naia pertaining to naia crates
Projects
None yet
Development

No branches or pull requests

2 participants