simplify pacing logic by introducing a SendPacingLimited send mode

This commit is contained in:
Marten Seemann 2023-04-30 11:44:43 +02:00
parent 470ae7b39b
commit 9d70bc24a5
8 changed files with 28 additions and 47 deletions

View file

@ -1739,7 +1739,7 @@ func (s *connection) sendPackets() error {
var sentPacket bool // only used in for packets sent in send mode SendAny
for {
sendMode := s.sentPacketHandler.SendMode()
if sendMode == ackhandler.SendAny && !s.sentPacketHandler.HasPacingBudget() {
if sendMode == ackhandler.SendPacingLimited {
deadline := s.sentPacketHandler.TimeUntilSend()
if deadline.IsZero() {
deadline = deadlineSendImmediately
@ -1753,6 +1753,7 @@ func (s *connection) sendPackets() error {
}
sendMode = ackhandler.SendAck
}
//nolint:exhaustive // No need to handle pacing limited here.
switch sendMode {
case ackhandler.SendNone:
return nil