forked from quic-go/quic-go
Move calls to GetWindowUpdate out of the send loop
This commit is contained in:
committed by
Lucas Clemente
parent
9d428d92f7
commit
fc8d937fce
15
session.go
15
session.go
@@ -562,19 +562,19 @@ func (s *session) handleCloseError(closeErr closeError) error {
|
||||
}
|
||||
|
||||
func (s *session) sendPacket() error {
|
||||
// Get WindowUpdate frames
|
||||
// this call triggers the flow controller to increase the flow control windows, if necessary
|
||||
windowUpdateFrames := s.getWindowUpdateFrames()
|
||||
for _, wuf := range windowUpdateFrames {
|
||||
s.packer.QueueControlFrameForNextPacket(wuf)
|
||||
}
|
||||
|
||||
// Repeatedly try sending until we don't have any more data, or run out of the congestion window
|
||||
for {
|
||||
if !s.sentPacketHandler.SendingAllowed() {
|
||||
return nil
|
||||
}
|
||||
|
||||
// get WindowUpdate frames
|
||||
// this call triggers the flow controller to increase the flow control windows, if necessary
|
||||
windowUpdateFrames := s.getWindowUpdateFrames()
|
||||
for _, wuf := range windowUpdateFrames {
|
||||
s.packer.QueueControlFrameForNextPacket(wuf)
|
||||
}
|
||||
|
||||
// check for retransmissions first
|
||||
for {
|
||||
retransmitPacket := s.sentPacketHandler.DequeuePacketForRetransmission()
|
||||
@@ -646,6 +646,7 @@ func (s *session) sendPacket() error {
|
||||
for _, f := range windowUpdateFrames {
|
||||
s.packer.QueueControlFrameForNextPacket(f)
|
||||
}
|
||||
windowUpdateFrames = nil
|
||||
|
||||
err = s.sendPackedPacket(packet)
|
||||
if err != nil {
|
||||
|
||||
@@ -1069,14 +1069,13 @@ var _ = Describe("Session", func() {
|
||||
Expect(ok).To(BeTrue())
|
||||
})
|
||||
|
||||
It("retransmits a WindowUpdates if it hasn't already sent a WindowUpdate with a higher ByteOffset", func() {
|
||||
It("retransmits a WindowUpdate if it hasn't already sent a WindowUpdate with a higher ByteOffset", func() {
|
||||
_, err := sess.GetOrOpenStream(5)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
fcm := mocks_fc.NewMockFlowControlManager(mockCtrl)
|
||||
sess.flowControlManager = fcm
|
||||
fcm.EXPECT().GetWindowUpdates()
|
||||
fcm.EXPECT().GetReceiveWindow(protocol.StreamID(5)).Return(protocol.ByteCount(0x1000), nil)
|
||||
fcm.EXPECT().GetWindowUpdates()
|
||||
wuf := &frames.WindowUpdateFrame{
|
||||
StreamID: 5,
|
||||
ByteOffset: 0x1000,
|
||||
|
||||
Reference in New Issue
Block a user