windowsize atomicity
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Jake Hillion 2021-03-22 21:26:58 +00:00
parent 27f87c2645
commit 7a58c51037

View File

@ -260,11 +260,12 @@ func (c *NewReno) receivedAck(ack uint32) {
c.inFlight = c.inFlight[i:]
if c.slowStart {
c.windowSize += uint32(i)
atomic.AddUint32(&c.windowSize, uint32(i))
} else {
c.windowCount += uint32(i)
if c.windowCount > c.windowSize {
c.windowCount -= uint32(i)
s := c.windowSize
if c.windowCount > s {
c.windowCount -= s
atomic.AddUint32(&c.windowSize, 1)
}
}