forked from quic-go/quic-go
restart the loss detection timer when the server becomes unblocked
This commit is contained in:
@@ -194,7 +194,11 @@ func (h *sentPacketHandler) dropPackets(encLevel protocol.EncryptionLevel) {
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) ReceivedBytes(n protocol.ByteCount) {
|
||||
wasAmplificationLimit := h.isAmplificationLimited()
|
||||
h.bytesReceived += n
|
||||
if wasAmplificationLimit && !h.isAmplificationLimited() {
|
||||
h.setLossDetectionTimer()
|
||||
}
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) ReceivedPacket(encLevel protocol.EncryptionLevel) {
|
||||
|
||||
@@ -828,7 +828,7 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
Expect(handler.SendMode()).To(Equal(SendNone))
|
||||
})
|
||||
|
||||
It("cancels the loss detection timer when it is amplification limited", func() {
|
||||
It("cancels the loss detection timer when it is amplification limited, and resets it when becoming unblocked", func() {
|
||||
handler.ReceivedBytes(300)
|
||||
handler.SentPacket(&Packet{
|
||||
PacketNumber: 1,
|
||||
@@ -837,7 +837,11 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
Frames: []Frame{{Frame: &wire.PingFrame{}}},
|
||||
SendTime: time.Now(),
|
||||
})
|
||||
// Amplification limited. We don't need to set a timer now.
|
||||
Expect(handler.GetLossDetectionTimeout()).To(BeZero())
|
||||
// Unblock the server. Now we should fire up the timer.
|
||||
handler.ReceivedBytes(1)
|
||||
Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero())
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user