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

[LurkServer] Implement graceful shutdown #34

Open
boris-sinyapkin opened this issue Aug 26, 2024 · 0 comments
Open

[LurkServer] Implement graceful shutdown #34

boris-sinyapkin opened this issue Aug 26, 2024 · 0 comments

Comments

@boris-sinyapkin
Copy link
Owner

boris-sinyapkin commented Aug 26, 2024

Server should terminate gracefully, closing all the resources and tasks.
This could be done through tokio task tracker (see join set as well).

Canceling event could be awaited in main loop as following:

tokio::select! {
  conn = listener.accept() => { /* process conn */ },
  _ = cancel_event => { /* shutdown */ }
}

Tasks spawned for clients could be spawned through TaskTracker and then awaited on shutdown.

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