merge develop into master #21

Merged
JakeHillion merged 149 commits from develop into master 2021-05-12 00:22:59 +01:00
Showing only changes of commit a6a6d97e88 - Show all commits

View File

@ -130,14 +130,15 @@ func (c *NewReno) AwaitEarlyUpdate(keepalive time.Duration) uint32 {
c.checkNack()
// CASE 1: waiting ACKs or NACKs and no message sent in the last RTT
if ((c.lastAck != c.ack) || (c.lastNack != c.nack)) && time.Now().After(c.lastSent.Add(rtt)) {
return 0
// CASE 1: waiting ACKs or NACKs and no message sent in the last half-RTT
// this targets arrival in 0.5+0.5 ± 0.5 RTTs (1±0.5 RTTs)
if ((c.lastAck != c.ack) || (c.lastNack != c.nack)) && time.Now().After(c.lastSent.Add(rtt / 2)) {
return 0 // no ack needed
}
// CASE 3: No message sent within the keepalive time
// CASE 2: No message sent within the keepalive time
if keepalive != 0 && time.Now().After(c.lastSent.Add(keepalive)) {
return c.Sequence()
return c.Sequence() // require an ack
}
}
}