summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2019-02-20 20:13:33 +0100
committerSimon Rozman <simon@rozman.si>2019-02-20 20:13:33 +0100
commitac4944a70855bdd869eb070bd80700e789024579 (patch)
tree7789d4ce5cd80f4d3adaf0a9a2e38a6464c424e5
parent2491f9d4540cac7d38805531ab120e9f2d1cdfb3 (diff)
wintun: Write exchange buffer increased back to 1MiB
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r--tun/tun_windows.go9
1 files changed, 4 insertions, 5 deletions
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 {