Move calls to GetWindowUpdate out of the send loop

This commit is contained in:
Lucas Clemente
2017-06-20 11:50:43 +02:00
committed by Lucas Clemente
parent 9d428d92f7
commit fc8d937fce
2 changed files with 9 additions and 9 deletions

View File

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