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>
This commit is contained in:
		
							parent
							
								
									fbf97502cf
								
							
						
					
					
						commit
						75526d6071
					
				@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user