forked from quic-go/quic-go
always dequeue a StopWaiting if a packet contains a retransmission
This commit is contained in:
@@ -448,6 +448,7 @@ func (s *Session) sendPacket() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var controlFrames []frames.Frame
|
var controlFrames []frames.Frame
|
||||||
|
var hasRetransmission bool
|
||||||
|
|
||||||
// check for retransmissions first
|
// check for retransmissions first
|
||||||
for {
|
for {
|
||||||
@@ -455,6 +456,7 @@ func (s *Session) sendPacket() error {
|
|||||||
if retransmitPacket == nil {
|
if retransmitPacket == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
hasRetransmission = true
|
||||||
utils.Debugf("\tDequeueing retransmission for packet 0x%x", retransmitPacket.PacketNumber)
|
utils.Debugf("\tDequeueing retransmission for packet 0x%x", retransmitPacket.PacketNumber)
|
||||||
|
|
||||||
if s.version <= protocol.Version33 {
|
if s.version <= protocol.Version33 {
|
||||||
@@ -491,7 +493,7 @@ func (s *Session) sendPacket() error {
|
|||||||
if s.version <= protocol.Version33 {
|
if s.version <= protocol.Version33 {
|
||||||
stopWaitingFrame = s.stopWaitingManager.GetStopWaitingFrame()
|
stopWaitingFrame = s.stopWaitingManager.GetStopWaitingFrame()
|
||||||
} else {
|
} else {
|
||||||
if ack != nil {
|
if ack != nil || hasRetransmission {
|
||||||
stopWaitingFrame = s.sentPacketHandler.GetStopWaitingFrame()
|
stopWaitingFrame = s.sentPacketHandler.GetStopWaitingFrame()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ type mockSentPacketHandler struct {
|
|||||||
retransmissionQueue []*ackhandlerlegacy.Packet
|
retransmissionQueue []*ackhandlerlegacy.Packet
|
||||||
congestionLimited bool
|
congestionLimited bool
|
||||||
maybeQueueRTOsCalled bool
|
maybeQueueRTOsCalled bool
|
||||||
|
requestedStopWaiting bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *mockSentPacketHandler) SentPacket(packet *ackhandlerlegacy.Packet) error { return nil }
|
func (h *mockSentPacketHandler) SentPacket(packet *ackhandlerlegacy.Packet) error { return nil }
|
||||||
@@ -59,7 +60,8 @@ func (h *mockSentPacketHandler) ReceivedAck(ackFrame *frames.AckFrame, withPacke
|
|||||||
func (h *mockSentPacketHandler) BytesInFlight() protocol.ByteCount { return 0 }
|
func (h *mockSentPacketHandler) BytesInFlight() protocol.ByteCount { return 0 }
|
||||||
func (h *mockSentPacketHandler) GetLeastUnacked() protocol.PacketNumber { return 1 }
|
func (h *mockSentPacketHandler) GetLeastUnacked() protocol.PacketNumber { return 1 }
|
||||||
func (h *mockSentPacketHandler) GetStopWaitingFrame() *frames.StopWaitingFrame {
|
func (h *mockSentPacketHandler) GetStopWaitingFrame() *frames.StopWaitingFrame {
|
||||||
panic("not implemented")
|
h.requestedStopWaiting = true
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
func (h *mockSentPacketHandler) CongestionAllowsSending() bool { return !h.congestionLimited }
|
func (h *mockSentPacketHandler) CongestionAllowsSending() bool { return !h.congestionLimited }
|
||||||
func (h *mockSentPacketHandler) CheckForError() error { return nil }
|
func (h *mockSentPacketHandler) CheckForError() error { return nil }
|
||||||
@@ -542,6 +544,9 @@ var _ = Describe("Session", func() {
|
|||||||
err := session.sendPacket()
|
err := session.sendPacket()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(conn.written).To(HaveLen(1))
|
Expect(conn.written).To(HaveLen(1))
|
||||||
|
if session.version > protocol.Version33 { // before version 34, this was handled by the StopWaitingManager
|
||||||
|
Expect(sph.(*mockSentPacketHandler).requestedStopWaiting).To(BeTrue())
|
||||||
|
}
|
||||||
Expect(conn.written[0]).To(ContainSubstring("foobar1234567"))
|
Expect(conn.written[0]).To(ContainSubstring("foobar1234567"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user