From 62b512fbae816d915f0ea305045b5c517fad758f Mon Sep 17 00:00:00 2001 From: Luna Yao <40349250+ZnqbuZ@users.noreply.github.com> Date: Sun, 5 Apr 2026 10:37:51 +0200 Subject: [PATCH] stop dns in Drop of Instance --- easytier/src/instance/instance.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/easytier/src/instance/instance.rs b/easytier/src/instance/instance.rs index 922a289d..517f0aef 100644 --- a/easytier/src/instance/instance.rs +++ b/easytier/src/instance/instance.rs @@ -1404,9 +1404,16 @@ impl Drop for Instance { fn drop(&mut self) { let my_peer_id = self.peer_manager.my_peer_id(); let pm = Arc::downgrade(&self.peer_manager); + #[cfg(feature = "magic-dns")] + let dns = self.dns.clone(); #[cfg(feature = "tun")] let nic_ctx = self.nic_ctx.clone(); tokio::spawn(async move { + // TODO: change this + #[cfg(feature = "magic-dns")] + dns.stop().await.unwrap_or_else(|e| { + tracing::error!("failed to stop dns, err: {:?}", e); + }); #[cfg(feature = "tun")] nic_ctx.lock().await.take(); if let Some(pm) = pm.upgrade() {