From 50e282a614e195a569bfe76cd6c8b6d0ed2b7402 Mon Sep 17 00:00:00 2001 From: SajjadPourali Date: Thu, 9 Oct 2025 20:57:34 -0700 Subject: [PATCH 1/2] Drop task handle in IpStack --- src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7a5ce7e..a7e55dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,7 +83,7 @@ impl IpStackConfig { pub struct IpStack { accept_receiver: UnboundedReceiver, - _handle: JoinHandle>, // Just hold the task handle + handle: JoinHandle>, // Just hold the task handle } impl IpStack { @@ -94,7 +94,7 @@ impl IpStack { let (accept_sender, accept_receiver) = mpsc::unbounded_channel::(); IpStack { accept_receiver, - _handle: run(config, device, accept_sender), + handle: run(config, device, accept_sender), } } @@ -103,6 +103,12 @@ impl IpStack { } } +impl Drop for IpStack { + fn drop(&mut self) { + self.handle.abort(); + } +} + fn run( config: IpStackConfig, mut device: Device, From 5065b61eefbbb9316deac888e999466ad15c8e8b Mon Sep 17 00:00:00 2001 From: Sajjad Pourali Date: Fri, 10 Oct 2025 08:17:45 -0700 Subject: [PATCH 2/2] Removed unrelated comment --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a7e55dc..eb01e94 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,7 +83,7 @@ impl IpStackConfig { pub struct IpStack { accept_receiver: UnboundedReceiver, - handle: JoinHandle>, // Just hold the task handle + handle: JoinHandle>, } impl IpStack {