UDT: Fix another critical bug. udtSocketRecv.farNextPktSeq was not incremented.

Note: The open bug #43 is still pending, although it will give a warning now. The warning can be used as debugging point.
This commit is contained in:
Kleissner
2021-10-25 04:50:40 +02:00
parent 2df8dba4fe
commit 2984dc6b79

View File

@@ -226,7 +226,8 @@ func (s *udtSocketRecv) ingestData(p *packet.DataPacket, now time.Time) {
excluding) these two values into the receiver's loss list and
send them to the sender in an NAK packet. */
seqDiff := seq.BlindDiff(s.farNextPktSeq)
if seqDiff > 0 && false {
if seqDiff > 0 {
fmt.Printf("Warning sequence out of order :( Code that follows will crash. Expected %d but received is %d\n", s.farNextPktSeq, p.Seq)
newLoss := make(receiveLossHeap, 0, seqDiff)
for idx := s.farNextPktSeq; idx != seq; idx.Incr() {
newLoss = append(newLoss, recvLossEntry{packetID: seq})
@@ -257,6 +258,8 @@ func (s *udtSocketRecv) ingestData(p *packet.DataPacket, now time.Time) {
} else {
s.farRecdPktSeq, _ = s.recvLossList.Min(s.farRecdPktSeq, s.farNextPktSeq)
}
} else {
s.farNextPktSeq = seq.Add(1)
}
s.attemptProcessPacket(p, true)