]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
wintun: Adjust tunRWQueue.left member to match Wintun driver
authorSimon Rozman <simon@rozman.si>
Thu, 7 Feb 2019 23:19:56 +0000 (00:19 +0100)
committerSimon Rozman <simon@rozman.si>
Fri, 8 Feb 2019 06:32:12 +0000 (07:32 +0100)
Signed-off-by: Simon Rozman <simon@rozman.si>
tun/tun_windows.go

index 5c231e708c0589d6fd3d1738a11ece8553daa17f..f284baf89138146ce6f948c8d781cf8ff76fb5c5 100644 (file)
@@ -36,7 +36,7 @@ type tunPacket struct {
 type tunRWQueue struct {
        numPackets uint32
        packets    [TUN_MAX_PACKET_EXCHANGE]tunPacket
-       left       uint32
+       left       bool
 }
 
 type nativeTun struct {
@@ -229,7 +229,7 @@ func (tun *nativeTun) Read(buff []byte, offset int) (int, error) {
                                }
                        }
 
-                       if tun.rdBuff.numPackets < TUN_MAX_PACKET_EXCHANGE || tun.rdBuff.left == 0 {
+                       if tun.rdBuff.numPackets < TUN_MAX_PACKET_EXCHANGE || !tun.rdBuff.left {
                                // Buffer was not full. Wait for the interface data or user close.
                                r, err := windows.WaitForMultipleObjects(tun.signals[:], false, windows.INFINITE)
                                if err != nil {