]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
wintun: Write exchange buffer increased back to 1MiB
authorSimon Rozman <simon@rozman.si>
Wed, 20 Feb 2019 19:13:33 +0000 (20:13 +0100)
committerSimon Rozman <simon@rozman.si>
Wed, 20 Feb 2019 19:13:33 +0000 (20:13 +0100)
Signed-off-by: Simon Rozman <simon@rozman.si>
tun/tun_windows.go

index 5640a5d065a68bc58abebcdcee48fc4a4bf164c1..137eb6cf6058cca711b486897b334841722334ec 100644 (file)
@@ -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 {