From 18dc9e4ca373cef0339e7a59660399e8065cec54 Mon Sep 17 00:00:00 2001 From: Luna Yao <40349250+ZnqbuZ@users.noreply.github.com> Date: Mon, 6 Apr 2026 00:07:21 +0200 Subject: [PATCH] instance: drop dns in Drop --- easytier/src/instance/instance.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/easytier/src/instance/instance.rs b/easytier/src/instance/instance.rs index 7e2735a1..4b926e70 100644 --- a/easytier/src/instance/instance.rs +++ b/easytier/src/instance/instance.rs @@ -1401,6 +1401,7 @@ impl Instance { } } +// TODO: duplicated with clear_resources? impl Drop for Instance { fn drop(&mut self) { let my_peer_id = self.peer_manager.my_peer_id(); @@ -1412,9 +1413,12 @@ impl Drop for Instance { 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); - }); + { + dns.stop().await.unwrap_or_else(|e| { + tracing::error!("failed to stop dns, err: {:?}", e); + }); + drop(dns); + } #[cfg(feature = "tun")] nic_ctx.lock().await.take(); if let Some(pm) = pm.upgrade() {