Open boris-sinyapkin opened 3 months ago
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.
TaskTracker
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:
Tasks spawned for clients could be spawned through
TaskTracker
and then awaited on shutdown.