From ac4944a70855bdd869eb070bd80700e789024579 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Wed, 20 Feb 2019 20:13:33 +0100 Subject: wintun: Write exchange buffer increased back to 1MiB Signed-off-by: Simon Rozman --- tun/tun_windows.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tun') diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 5640a5d..137eb6c 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -19,18 +19,17 @@ const ( packetExchangeMax uint32 = 256 // Number of packets that may be written at a time packetExchangeAlignment uint32 = 16 // Number of bytes packets are aligned to in exchange buffers packetSizeMax uint32 = 0xf000 - packetExchangeAlignment // Maximum packet size - packetExchangeSizeRead uint32 = 0x100000 // Read exchange buffer size (defaults to 1MiB) - packetExchangeSizeWrite uint32 = 0x10000 // Write exchange buffer size (defaults to 64kiB) + packetExchangeSize uint32 = 0x100000 // Exchange buffer size (defaults to 1MiB) ) type exchgBufRead struct { - data [packetExchangeSizeRead]byte + data [packetExchangeSize]byte offset uint32 avail uint32 } type exchgBufWrite struct { - data [packetExchangeSizeWrite]byte + data [packetExchangeSize]byte offset uint32 packetNum uint32 } @@ -323,7 +322,7 @@ func (tun *nativeTun) putTunPacket(buff []byte) error { } pSize := packetAlign(packetExchangeAlignment + size) - if tun.wrBuff.packetNum >= packetExchangeMax || tun.wrBuff.offset+pSize >= packetExchangeSizeWrite { + if tun.wrBuff.packetNum >= packetExchangeMax || tun.wrBuff.offset+pSize >= packetExchangeSize { // Exchange buffer is full -> flush first. err := tun.flush() if err != nil { -- cgit v1.2.3