[mio] 增加缓冲区长度

This commit is contained in:
lubeilin
2024-03-10 14:05:51 +08:00
parent f2b21c9e4a
commit 6850681352
+3 -3
View File
@@ -100,7 +100,7 @@ impl Device {
));
}
// 开启session
let session = win_tun.WintunStartSession(adapter, 128 * 1024);
let session = win_tun.WintunStartSession(adapter, MAX_RING_CAPACITY);
if session.is_null() {
log::error!("session.is_null {:?}", io::Error::last_os_error());
return Err(io::Error::new(
@@ -249,9 +249,9 @@ impl Device {
}
pub fn receive_blocking(&self) -> io::Result<packet::TunPacket> {
loop {
//Try 5 times to receive without blocking so we don't have to issue a syscall to wait
//Try 16 times to receive without blocking so we don't have to issue a syscall to wait
//for the event if packets are being received at a rapid rate
for _ in 0..5 {
for _i in 0..20 {
match self.try_receive()? {
None => {
continue;