|
As example simple_broker.rs. I have added In the logging is see this : and sys_topcis keeps logging. So it seems the broker is still alive. My question is : what is the purpose of shutdown function ? Even after shutdown, clients can still connect : ^C2026-07-03T16:28:08.396136Z INFO simple_broker: 2026-07-03T16:28:19.486687Z INFO mqtt5::broker::client_handler: Unregistering client mqttx_635dff9b2 (not taken over) |
Replies: 2 comments
|
Hi, good catch. These examples are very old, so it's time I revisited them to make sure they show coherent behaviour. shutdown_rx.recv().await.ok(); // parks here until the internal signal fires
info!("Broker shutting down");
sys_handle.abort(); // only now is the $SYS task stopped
// then all spawned handles are joined (5s timeout)Those tasks are detached, so dropping the The example does the wrong thing here: tokio::select! {
result = broker.run() => { ... }
_ = shutdown => { info!("Shutting down broker..."); } // ctrl_c wins here
}So, on Ctrl+C the |
|
Thanks for the update. |
Thanks for the update.