]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
conn: windows: set count=0 on retry
authorJason A. Donenfeld <Jason@zx2c4.com>
Tue, 11 May 2021 14:47:17 +0000 (16:47 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Tue, 11 May 2021 14:47:17 +0000 (16:47 +0200)
When retrying, if count is not 0, we forget to dequeue another request,
and so the ring fills up and errors out.

Reported-by: Sascha Dierberg <dierberg@dresearch-fe.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
conn/bind_windows.go

index 42208b1767715055800a42862a0f95aca1c16e9f..d744987592ad792b2667e13ed219496ddb0103c3 100644 (file)
@@ -357,6 +357,7 @@ func (bind *afWinRingBind) Receive(buf []byte, isOpen *uint32) (int, Endpoint, e
        var count uint32
        var results [1]winrio.Result
 retry:
+       count = 0
        for tries := 0; count == 0 && tries < receiveSpins; tries++ {
                if tries > 0 {
                        if atomic.LoadUint32(isOpen) != 1 {