diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-04-08 18:17:59 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-04-09 14:26:08 -0600 |
commit | 75526d60714ce2e2e967830b42422788fb1b7498 (patch) | |
tree | e35707b1ee2775b4b22b55eabe193bf9e5c01b84 /conn | |
parent | fbf97502cfcfcf35e7963e02b4412e46396334a1 (diff) |
conn: windows: compare head and tail properly
By not comparing these with the modulo, the ring became nearly never
full, resulting in completion queue buffers filling up prematurely.
Reported-by: Joshua Sjoding <joshua.sjoding@scjalliance.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'conn')
-rw-r--r-- | conn/bind_windows.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/conn/bind_windows.go b/conn/bind_windows.go index 6cabee1..a25c7aa 100644 --- a/conn/bind_windows.go +++ b/conn/bind_windows.go @@ -47,7 +47,7 @@ func (rb *ringBuffer) Push() *ringPacket { } ret := (*ringPacket)(unsafe.Pointer(rb.packets + (uintptr(rb.tail%packetsPerRing) * unsafe.Sizeof(ringPacket{})))) rb.tail += 1 - if rb.tail == rb.head { + if rb.tail%packetsPerRing == rb.head%packetsPerRing { rb.isFull = true } return ret |