forked from quic-go/quic-go
call OnCongestionEvent when packets are retransmitted due to an RTO
fixes #168
This commit is contained in:
@@ -311,8 +311,13 @@ func (h *sentPacketHandler) maybeQueuePacketsRTO() {
|
||||
for p := h.highestInOrderAckedPacketNumber + 1; p <= h.lastSentPacketNumber; p++ {
|
||||
packet := h.packetHistory[p]
|
||||
if packet != nil && !packet.Retransmitted {
|
||||
h.queuePacketForRetransmission(packet)
|
||||
packetsLost := congestion.PacketVector{congestion.PacketInfo{
|
||||
Number: packet.PacketNumber,
|
||||
Length: packet.Length,
|
||||
}}
|
||||
h.congestion.OnCongestionEvent(false, h.BytesInFlight(), nil, packetsLost)
|
||||
h.congestion.OnRetransmissionTimeout(true)
|
||||
h.queuePacketForRetransmission(packet)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,6 +633,13 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
handler.lastSentPacketTime = time.Now().Add(-time.Second)
|
||||
handler.maybeQueuePacketsRTO()
|
||||
Expect(cong.nCalls).To(Equal(3))
|
||||
// rttUpdated, bytesInFlight, ackedPackets, lostPackets
|
||||
Expect(cong.argsOnCongestionEvent[0]).To(BeFalse())
|
||||
Expect(cong.argsOnCongestionEvent[1]).To(Equal(protocol.ByteCount(1)))
|
||||
Expect(cong.argsOnCongestionEvent[2]).To(BeEmpty())
|
||||
Expect(cong.argsOnCongestionEvent[3]).To(Equal(congestion.PacketVector{{1, 1}}))
|
||||
|
||||
Expect(cong.onRetransmissionTimeout).To(BeTrue())
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user