server: lifecycle

This commit is contained in:
Luna Yao
2026-03-31 03:37:23 +02:00
parent 70fba64e17
commit 08a1640e30
3 changed files with 11 additions and 7 deletions
+5 -1
View File
@@ -270,7 +270,7 @@ impl DnsServer {
Ok(())
}
pub async fn run(&self) {
pub async fn run(&self, token: CancellationToken) {
let dirty = &self.mgr.dirty;
let mut runtime = None;
@@ -314,6 +314,10 @@ impl DnsServer {
};
tokio::select!(
_ = token.cancelled() => {
tracing::info!("DnsServer received shutdown signal, exiting server loop");
}
_ = reload_catalog => {},
_ = reload_addresses => {},
_ = reload_listeners => {},