From c0ebb02aab2734f422511aa0d347799b18b48894 Mon Sep 17 00:00:00 2001 From: lbl <1791778603@qq.com> Date: Mon, 16 Dec 2024 18:49:47 +0800 Subject: [PATCH] call WintunReleaseReceivePacket --- src/session.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/session.rs b/src/session.rs index f17c0b7..640ac34 100644 --- a/src/session.rs +++ b/src/session.rs @@ -173,10 +173,16 @@ impl Session { } let size = size as usize; if size > buf.len() { + unsafe { + wintun.WintunReleaseReceivePacket(self.inner.0, ptr); + } use std::io::{Error, ErrorKind::InvalidInput}; return Err(Error::new(InvalidInput, "destination buffer too small")); } unsafe { ptr::copy_nonoverlapping(ptr, buf.as_mut_ptr(), size) }; + unsafe { + wintun.WintunReleaseReceivePacket(self.inner.0, ptr); + } Ok(size) }