call OnCongestionEvent when packets are retransmitted due to an RTO

fixes #168
This commit is contained in:
Lucas Clemente
2016-06-06 11:56:32 +02:00
parent d5aced6e03
commit 4d5ff5d61e
2 changed files with 13 additions and 1 deletions

View File

@@ -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
}
}

View File

@@ -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())
})
})