From 92f7fa5a1ac5c16f3f40e16de995f366e1ebfd76 Mon Sep 17 00:00:00 2001 From: dilluti0n Date: Mon, 13 Jul 2026 23:47:07 +0900 Subject: [PATCH] Relax shutdown() receiver to &self Unblocking WinDivertRecv() from another thread is in fact the whole purpose of WinDivertShutdown(), but &mut self made that impossible on a shared (Arc) handle. It only reads self.handle and doesn't invalidate it, so &self is sound. --- windivert/src/divert/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windivert/src/divert/mod.rs b/windivert/src/divert/mod.rs index 66e65a9..86b6cd3 100644 --- a/windivert/src/divert/mod.rs +++ b/windivert/src/divert/mod.rs @@ -104,7 +104,7 @@ impl WinDivert { } /// Shutdown function. - pub fn shutdown(&mut self, mode: WinDivertShutdownMode) -> WinResult<()> { + pub fn shutdown(&self, mode: WinDivertShutdownMode) -> WinResult<()> { let res = unsafe { sys::WinDivertShutdown(self.handle, mode) }; if !res.as_bool() { return Err(WinError::from(unsafe { GetLastError() }));