pass the current timestamp to the pacer instead of calling time.Now() (#3824)

This commit is contained in:
Marten Seemann 2023-06-03 10:26:30 +03:00 committed by GitHub
parent 072a602cc1
commit b27d114f07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 114 additions and 127 deletions

View file

@ -1730,12 +1730,13 @@ func (s *connection) applyTransportParameters() {
func (s *connection) triggerSending() error { func (s *connection) triggerSending() error {
s.pacingDeadline = time.Time{} s.pacingDeadline = time.Time{}
now := time.Now()
sendMode := s.sentPacketHandler.SendMode() sendMode := s.sentPacketHandler.SendMode(now)
//nolint:exhaustive // No need to handle pacing limited here. //nolint:exhaustive // No need to handle pacing limited here.
switch sendMode { switch sendMode {
case ackhandler.SendAny: case ackhandler.SendAny:
return s.sendPackets() return s.sendPackets(now)
case ackhandler.SendNone: case ackhandler.SendNone:
return nil return nil
case ackhandler.SendPacingLimited: case ackhandler.SendPacingLimited:
@ -1752,9 +1753,9 @@ func (s *connection) triggerSending() error {
// We can at most send a single ACK only packet. // We can at most send a single ACK only packet.
// There will only be a new ACK after receiving new packets. // There will only be a new ACK after receiving new packets.
// SendAck is only returned when we're congestion limited, so we don't need to set the pacinggs timer. // SendAck is only returned when we're congestion limited, so we don't need to set the pacinggs timer.
return s.maybeSendAckOnlyPacket() return s.maybeSendAckOnlyPacket(now)
case ackhandler.SendPTOInitial: case ackhandler.SendPTOInitial:
if err := s.sendProbePacket(protocol.EncryptionInitial); err != nil { if err := s.sendProbePacket(protocol.EncryptionInitial, now); err != nil {
return err return err
} }
if s.sendQueue.WouldBlock() { if s.sendQueue.WouldBlock() {
@ -1763,7 +1764,7 @@ func (s *connection) triggerSending() error {
} }
return s.triggerSending() return s.triggerSending()
case ackhandler.SendPTOHandshake: case ackhandler.SendPTOHandshake:
if err := s.sendProbePacket(protocol.EncryptionHandshake); err != nil { if err := s.sendProbePacket(protocol.EncryptionHandshake, now); err != nil {
return err return err
} }
if s.sendQueue.WouldBlock() { if s.sendQueue.WouldBlock() {
@ -1772,7 +1773,7 @@ func (s *connection) triggerSending() error {
} }
return s.triggerSending() return s.triggerSending()
case ackhandler.SendPTOAppData: case ackhandler.SendPTOAppData:
if err := s.sendProbePacket(protocol.Encryption1RTT); err != nil { if err := s.sendProbePacket(protocol.Encryption1RTT, now); err != nil {
return err return err
} }
if s.sendQueue.WouldBlock() { if s.sendQueue.WouldBlock() {
@ -1785,8 +1786,7 @@ func (s *connection) triggerSending() error {
} }
} }
func (s *connection) sendPackets() error { func (s *connection) sendPackets(now time.Time) error {
now := time.Now()
// Path MTU Discovery // Path MTU Discovery
// Can't use GSO, since we need to send a single packet that's larger than our current maximum size. // Can't use GSO, since we need to send a single packet that's larger than our current maximum size.
// Performance-wise, this doesn't matter, since we only send a very small (<10) number of // Performance-wise, this doesn't matter, since we only send a very small (<10) number of
@ -1817,7 +1817,7 @@ func (s *connection) sendPackets() error {
} }
s.sentFirstPacket = true s.sentFirstPacket = true
s.sendPackedCoalescedPacket(packet, now) s.sendPackedCoalescedPacket(packet, now)
sendMode := s.sentPacketHandler.SendMode() sendMode := s.sentPacketHandler.SendMode(now)
if sendMode == ackhandler.SendPacingLimited { if sendMode == ackhandler.SendPacingLimited {
s.resetPacingDeadline() s.resetPacingDeadline()
} else if sendMode == ackhandler.SendAny { } else if sendMode == ackhandler.SendAny {
@ -1848,7 +1848,7 @@ func (s *connection) sendPacketsWithoutGSO(now time.Time) error {
if s.sendQueue.WouldBlock() { if s.sendQueue.WouldBlock() {
return nil return nil
} }
sendMode := s.sentPacketHandler.SendMode() sendMode := s.sentPacketHandler.SendMode(now)
if sendMode == ackhandler.SendPacingLimited { if sendMode == ackhandler.SendPacingLimited {
s.resetPacingDeadline() s.resetPacingDeadline()
return nil return nil
@ -1883,7 +1883,7 @@ func (s *connection) sendPacketsWithGSO(now time.Time) error {
} }
if !dontSendMore { if !dontSendMore {
sendMode := s.sentPacketHandler.SendMode() sendMode := s.sentPacketHandler.SendMode(now)
if sendMode == ackhandler.SendPacingLimited { if sendMode == ackhandler.SendPacingLimited {
s.resetPacingDeadline() s.resetPacingDeadline()
} }
@ -1927,8 +1927,7 @@ func (s *connection) resetPacingDeadline() {
s.pacingDeadline = deadline s.pacingDeadline = deadline
} }
func (s *connection) maybeSendAckOnlyPacket() error { func (s *connection) maybeSendAckOnlyPacket(now time.Time) error {
now := time.Now()
if !s.handshakeConfirmed { if !s.handshakeConfirmed {
packet, err := s.packer.PackCoalescedPacket(true, s.mtuDiscoverer.CurrentSize(), now, s.version) packet, err := s.packer.PackCoalescedPacket(true, s.mtuDiscoverer.CurrentSize(), now, s.version)
if err != nil { if err != nil {
@ -1954,8 +1953,7 @@ func (s *connection) maybeSendAckOnlyPacket() error {
return nil return nil
} }
func (s *connection) sendProbePacket(encLevel protocol.EncryptionLevel) error { func (s *connection) sendProbePacket(encLevel protocol.EncryptionLevel, now time.Time) error {
now := time.Now()
// Queue probe packets until we actually send out a packet, // Queue probe packets until we actually send out a packet,
// or until there are no more packets to queue. // or until there are no more packets to queue.
var packet *coalescedPacket var packet *coalescedPacket

View file

@ -610,7 +610,7 @@ var _ = Describe("Connection", func() {
conn.sendQueue = newSendQueue(sconn) conn.sendQueue = newSendQueue(sconn)
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().GetLossDetectionTimeout().Return(time.Now().Add(time.Hour)).AnyTimes() sph.EXPECT().GetLossDetectionTimeout().Return(time.Now().Add(time.Hour)).AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
// only expect a single SentPacket() call // only expect a single SentPacket() call
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
tracer.EXPECT().SentShortHeaderPacket(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()) tracer.EXPECT().SentShortHeaderPacket(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any())
@ -1210,7 +1210,7 @@ var _ = Describe("Connection", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
conn.sentPacketHandler = sph conn.sentPacketHandler = sph
runConn() runConn()
@ -1248,7 +1248,7 @@ var _ = Describe("Connection", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAck) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAck)
done := make(chan struct{}) done := make(chan struct{})
packer.EXPECT().PackCoalescedPacket(true, gomock.Any(), gomock.Any(), conn.version).Do(func(bool, protocol.ByteCount, time.Time, protocol.VersionNumber) { close(done) }) packer.EXPECT().PackCoalescedPacket(true, gomock.Any(), gomock.Any(), conn.version).Do(func(bool, protocol.ByteCount, time.Time, protocol.VersionNumber) { close(done) })
conn.sentPacketHandler = sph conn.sentPacketHandler = sph
@ -1262,7 +1262,7 @@ var _ = Describe("Connection", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
conn.sentPacketHandler = sph conn.sentPacketHandler = sph
fc := mocks.NewMockConnectionFlowController(mockCtrl) fc := mocks.NewMockConnectionFlowController(mockCtrl)
@ -1283,7 +1283,7 @@ var _ = Describe("Connection", func() {
It("doesn't send when the SentPacketHandler doesn't allow it", func() { It("doesn't send when the SentPacketHandler doesn't allow it", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendNone).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone).AnyTimes()
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
conn.sentPacketHandler = sph conn.sentPacketHandler = sph
runConn() runConn()
@ -1317,8 +1317,8 @@ var _ = Describe("Connection", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().SendMode().Return(sendMode) sph.EXPECT().SendMode(gomock.Any()).Return(sendMode)
sph.EXPECT().SendMode().Return(ackhandler.SendNone) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone)
sph.EXPECT().QueueProbePacket(encLevel) sph.EXPECT().QueueProbePacket(encLevel)
p := getCoalescedPacket(123, enc != protocol.Encryption1RTT) p := getCoalescedPacket(123, enc != protocol.Encryption1RTT)
packer.EXPECT().MaybePackProbePacket(encLevel, gomock.Any(), gomock.Any(), conn.version).Return(p, nil) packer.EXPECT().MaybePackProbePacket(encLevel, gomock.Any(), gomock.Any(), conn.version).Return(p, nil)
@ -1342,8 +1342,8 @@ var _ = Describe("Connection", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().SendMode().Return(sendMode) sph.EXPECT().SendMode(gomock.Any()).Return(sendMode)
sph.EXPECT().SendMode().Return(ackhandler.SendNone) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone)
sph.EXPECT().QueueProbePacket(encLevel).Return(false) sph.EXPECT().QueueProbePacket(encLevel).Return(false)
p := getCoalescedPacket(123, enc != protocol.Encryption1RTT) p := getCoalescedPacket(123, enc != protocol.Encryption1RTT)
packer.EXPECT().MaybePackProbePacket(encLevel, gomock.Any(), gomock.Any(), conn.version).Return(p, nil) packer.EXPECT().MaybePackProbePacket(encLevel, gomock.Any(), gomock.Any(), conn.version).Return(p, nil)
@ -1403,8 +1403,8 @@ var _ = Describe("Connection", func() {
It("sends multiple packets one by one immediately", func() { It("sends multiple packets one by one immediately", func() {
sph.EXPECT().SentPacket(gomock.Any()).Times(2) sph.EXPECT().SentPacket(gomock.Any()).Times(2)
sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(2) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(2)
sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited)
sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour)) sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour))
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 10}}, []byte("packet10")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 10}}, []byte("packet10"))
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 11}}, []byte("packet11")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 11}}, []byte("packet11"))
@ -1427,7 +1427,7 @@ var _ = Describe("Connection", func() {
It("sends multiple packets one by one immediately, with GSO", func() { It("sends multiple packets one by one immediately, with GSO", func() {
enableGSO() enableGSO()
sph.EXPECT().SentPacket(gomock.Any()).Times(2) sph.EXPECT().SentPacket(gomock.Any()).Times(2)
sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(3) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(3)
payload1 := make([]byte, conn.mtuDiscoverer.CurrentSize()) payload1 := make([]byte, conn.mtuDiscoverer.CurrentSize())
rand.Read(payload1) rand.Read(payload1)
payload2 := make([]byte, conn.mtuDiscoverer.CurrentSize()) payload2 := make([]byte, conn.mtuDiscoverer.CurrentSize())
@ -1451,8 +1451,8 @@ var _ = Describe("Connection", func() {
It("stops appending packets when a smaller packet is packed, with GSO", func() { It("stops appending packets when a smaller packet is packed, with GSO", func() {
enableGSO() enableGSO()
sph.EXPECT().SentPacket(gomock.Any()).Times(2) sph.EXPECT().SentPacket(gomock.Any()).Times(2)
sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(2) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(2)
sph.EXPECT().SendMode().Return(ackhandler.SendNone) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone)
payload1 := make([]byte, conn.mtuDiscoverer.CurrentSize()) payload1 := make([]byte, conn.mtuDiscoverer.CurrentSize())
rand.Read(payload1) rand.Read(payload1)
payload2 := make([]byte, conn.mtuDiscoverer.CurrentSize()-1) payload2 := make([]byte, conn.mtuDiscoverer.CurrentSize()-1)
@ -1474,7 +1474,7 @@ var _ = Describe("Connection", func() {
It("sends multiple packets, when the pacer allows immediate sending", func() { It("sends multiple packets, when the pacer allows immediate sending", func() {
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(2) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(2)
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 10}}, []byte("packet10")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 10}}, []byte("packet10"))
packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack)
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
@ -1491,7 +1491,7 @@ var _ = Describe("Connection", func() {
It("allows an ACK to be sent when pacing limited", func() { It("allows an ACK to be sent when pacing limited", func() {
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour)) sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour))
sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited)
packer.EXPECT().PackAckOnlyPacket(gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 123}}, getPacketBuffer(), nil) packer.EXPECT().PackAckOnlyPacket(gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 123}}, getPacketBuffer(), nil)
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
@ -1509,8 +1509,8 @@ var _ = Describe("Connection", func() {
// we shouldn't send the ACK in the same run // we shouldn't send the ACK in the same run
It("doesn't send an ACK right after becoming congestion limited", func() { It("doesn't send an ACK right after becoming congestion limited", func() {
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().SendMode().Return(ackhandler.SendAny) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny)
sph.EXPECT().SendMode().Return(ackhandler.SendAck) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAck)
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 100}}, []byte("packet100")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 100}}, []byte("packet100"))
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
sender.EXPECT().Send(gomock.Any(), gomock.Any()) sender.EXPECT().Send(gomock.Any(), gomock.Any())
@ -1526,15 +1526,15 @@ var _ = Describe("Connection", func() {
It("paces packets", func() { It("paces packets", func() {
pacingDelay := scaleDuration(100 * time.Millisecond) pacingDelay := scaleDuration(100 * time.Millisecond)
gomock.InOrder( gomock.InOrder(
sph.EXPECT().SendMode().Return(ackhandler.SendAny), sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny),
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 100}}, []byte("packet100")), expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 100}}, []byte("packet100")),
sph.EXPECT().SentPacket(gomock.Any()), sph.EXPECT().SentPacket(gomock.Any()),
sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited), sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited),
sph.EXPECT().TimeUntilSend().Return(time.Now().Add(pacingDelay)), sph.EXPECT().TimeUntilSend().Return(time.Now().Add(pacingDelay)),
sph.EXPECT().SendMode().Return(ackhandler.SendAny), sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny),
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 101}}, []byte("packet101")), expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 101}}, []byte("packet101")),
sph.EXPECT().SentPacket(gomock.Any()), sph.EXPECT().SentPacket(gomock.Any()),
sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited), sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited),
sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour)), sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour)),
) )
written := make(chan struct{}, 2) written := make(chan struct{}, 2)
@ -1553,8 +1553,8 @@ var _ = Describe("Connection", func() {
It("sends multiple packets at once", func() { It("sends multiple packets at once", func() {
sph.EXPECT().SentPacket(gomock.Any()).Times(3) sph.EXPECT().SentPacket(gomock.Any()).Times(3)
sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(3) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(3)
sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited)
sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour)) sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour))
for pn := protocol.PacketNumber(1000); pn < 1003; pn++ { for pn := protocol.PacketNumber(1000); pn < 1003; pn++ {
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: pn}}, []byte("packet")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: pn}}, []byte("packet"))
@ -1591,7 +1591,7 @@ var _ = Describe("Connection", func() {
written := make(chan struct{}) written := make(chan struct{})
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1000}}, []byte("packet1000")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1000}}, []byte("packet1000"))
packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack)
sender.EXPECT().Send(gomock.Any(), gomock.Any()).DoAndReturn(func(*packetBuffer, protocol.ByteCount) { close(written) }) sender.EXPECT().Send(gomock.Any(), gomock.Any()).DoAndReturn(func(*packetBuffer, protocol.ByteCount) { close(written) })
@ -1614,7 +1614,7 @@ var _ = Describe("Connection", func() {
sph.EXPECT().ReceivedBytes(gomock.Any()) sph.EXPECT().ReceivedBytes(gomock.Any())
conn.handlePacket(receivedPacket{buffer: getPacketBuffer()}) conn.handlePacket(receivedPacket{buffer: getPacketBuffer()})
}) })
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 10}}, []byte("packet10")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 10}}, []byte("packet10"))
packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack)
sender.EXPECT().Send(gomock.Any(), gomock.Any()).DoAndReturn(func(*packetBuffer, protocol.ByteCount) { close(written) }) sender.EXPECT().Send(gomock.Any(), gomock.Any()).DoAndReturn(func(*packetBuffer, protocol.ByteCount) { close(written) })
@ -1627,7 +1627,7 @@ var _ = Describe("Connection", func() {
It("stops sending when the send queue is full", func() { It("stops sending when the send queue is full", func() {
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().SendMode().Return(ackhandler.SendAny) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny)
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1000}}, []byte("packet1000")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1000}}, []byte("packet1000"))
written := make(chan struct{}, 1) written := make(chan struct{}, 1)
sender.EXPECT().WouldBlock() sender.EXPECT().WouldBlock()
@ -1646,7 +1646,7 @@ var _ = Describe("Connection", func() {
// now make room in the send queue // now make room in the send queue
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1001}}, []byte("packet1001")) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1001}}, []byte("packet1001"))
packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack)
@ -1660,7 +1660,7 @@ var _ = Describe("Connection", func() {
}) })
It("doesn't set a pacing timer when there is no data to send", func() { It("doesn't set a pacing timer when there is no data to send", func() {
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack)
// don't EXPECT any calls to mconn.Write() // don't EXPECT any calls to mconn.Write()
@ -1678,8 +1678,8 @@ var _ = Describe("Connection", func() {
conn.mtuDiscoverer = mtuDiscoverer conn.mtuDiscoverer = mtuDiscoverer
conn.config.DisablePathMTUDiscovery = false conn.config.DisablePathMTUDiscovery = false
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
sph.EXPECT().SendMode().Return(ackhandler.SendAny) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny)
sph.EXPECT().SendMode().Return(ackhandler.SendNone) sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone)
written := make(chan struct{}, 1) written := make(chan struct{}, 1)
sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().WouldBlock().AnyTimes()
sender.EXPECT().Send(gomock.Any(), gomock.Any()).DoAndReturn(func(*packetBuffer, protocol.ByteCount) { written <- struct{}{} }) sender.EXPECT().Send(gomock.Any(), gomock.Any()).DoAndReturn(func(*packetBuffer, protocol.ByteCount) { written <- struct{}{} })
@ -1727,7 +1727,7 @@ var _ = Describe("Connection", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sph.EXPECT().SentPacket(gomock.Any()) sph.EXPECT().SentPacket(gomock.Any())
conn.sentPacketHandler = sph conn.sentPacketHandler = sph
@ -1754,7 +1754,7 @@ var _ = Describe("Connection", func() {
packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack)
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sph.EXPECT().SentPacket(gomock.Any()).Do(func(p *ackhandler.Packet) { sph.EXPECT().SentPacket(gomock.Any()).Do(func(p *ackhandler.Packet) {
Expect(p.PacketNumber).To(Equal(protocol.PacketNumber(1234))) Expect(p.PacketNumber).To(Equal(protocol.PacketNumber(1234)))
}) })
@ -1806,7 +1806,7 @@ var _ = Describe("Connection", func() {
packer.EXPECT().PackCoalescedPacket(false, gomock.Any(), gomock.Any(), conn.version).AnyTimes() packer.EXPECT().PackCoalescedPacket(false, gomock.Any(), gomock.Any(), conn.version).AnyTimes()
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sph.EXPECT().TimeUntilSend().Return(time.Now()).AnyTimes() sph.EXPECT().TimeUntilSend().Return(time.Now()).AnyTimes()
gomock.InOrder( gomock.InOrder(
sph.EXPECT().SentPacket(gomock.Any()).Do(func(p *ackhandler.Packet) { sph.EXPECT().SentPacket(gomock.Any()).Do(func(p *ackhandler.Packet) {
@ -1860,7 +1860,7 @@ var _ = Describe("Connection", func() {
conn.sentPacketHandler = sph conn.sentPacketHandler = sph
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().SendMode().AnyTimes() sph.EXPECT().SendMode(gomock.Any()).AnyTimes()
sph.EXPECT().SetHandshakeConfirmed() sph.EXPECT().SetHandshakeConfirmed()
connRunner.EXPECT().Retire(clientDestConnID) connRunner.EXPECT().Retire(clientDestConnID)
go func() { go func() {
@ -1956,7 +1956,7 @@ var _ = Describe("Connection", func() {
It("sends a HANDSHAKE_DONE frame when the handshake completes", func() { It("sends a HANDSHAKE_DONE frame when the handshake completes", func() {
sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl)
sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes()
sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes()
sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes()
sph.EXPECT().SetHandshakeConfirmed() sph.EXPECT().SetHandshakeConfirmed()

View file

@ -20,7 +20,7 @@ type SentPacketHandler interface {
SetHandshakeConfirmed() SetHandshakeConfirmed()
// The SendMode determines if and what kind of packets can be sent. // The SendMode determines if and what kind of packets can be sent.
SendMode() SendMode SendMode(now time.Time) SendMode
// TimeUntilSend is the time when the next packet should be sent. // TimeUntilSend is the time when the next packet should be sent.
// It is used for pacing packets. // It is used for pacing packets.
TimeUntilSend() time.Time TimeUntilSend() time.Time

View file

@ -717,7 +717,7 @@ func (h *sentPacketHandler) PopPacketNumber(encLevel protocol.EncryptionLevel) p
return h.getPacketNumberSpace(encLevel).pns.Pop() return h.getPacketNumberSpace(encLevel).pns.Pop()
} }
func (h *sentPacketHandler) SendMode() SendMode { func (h *sentPacketHandler) SendMode(now time.Time) SendMode {
numTrackedPackets := h.appDataPackets.history.Len() numTrackedPackets := h.appDataPackets.history.Len()
if h.initialPackets != nil { if h.initialPackets != nil {
numTrackedPackets += h.initialPackets.history.Len() numTrackedPackets += h.initialPackets.history.Len()
@ -756,7 +756,7 @@ func (h *sentPacketHandler) SendMode() SendMode {
} }
return SendAck return SendAck
} }
if !h.congestion.HasPacingBudget() { if !h.congestion.HasPacingBudget(now) {
return SendPacingLimited return SendPacingLimited
} }
return SendAny return SendAny
@ -766,10 +766,6 @@ func (h *sentPacketHandler) TimeUntilSend() time.Time {
return h.congestion.TimeUntilSend(h.bytesInFlight) return h.congestion.TimeUntilSend(h.bytesInFlight)
} }
func (h *sentPacketHandler) HasPacingBudget() bool {
return h.congestion.HasPacingBudget()
}
func (h *sentPacketHandler) SetMaxDatagramSize(s protocol.ByteCount) { func (h *sentPacketHandler) SetMaxDatagramSize(s protocol.ByteCount) {
h.congestion.SetMaxDatagramSize(s) h.congestion.SetMaxDatagramSize(s)
} }

View file

@ -599,29 +599,29 @@ var _ = Describe("SentPacketHandler", func() {
SendTime: time.Now(), SendTime: time.Now(),
}) })
cong.EXPECT().CanSend(protocol.ByteCount(42)).Return(true) cong.EXPECT().CanSend(protocol.ByteCount(42)).Return(true)
cong.EXPECT().HasPacingBudget().Return(true) cong.EXPECT().HasPacingBudget(gomock.Any()).Return(true)
handler.SendMode() handler.SendMode(time.Now())
}) })
It("allows sending of ACKs when congestion limited", func() { It("allows sending of ACKs when congestion limited", func() {
handler.ReceivedPacket(protocol.EncryptionHandshake) handler.ReceivedPacket(protocol.EncryptionHandshake)
cong.EXPECT().CanSend(gomock.Any()).Return(true) cong.EXPECT().CanSend(gomock.Any()).Return(true)
cong.EXPECT().HasPacingBudget().Return(true) cong.EXPECT().HasPacingBudget(gomock.Any()).Return(true)
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
cong.EXPECT().CanSend(gomock.Any()).Return(false) cong.EXPECT().CanSend(gomock.Any()).Return(false)
Expect(handler.SendMode()).To(Equal(SendAck)) Expect(handler.SendMode(time.Now())).To(Equal(SendAck))
}) })
It("allows sending of ACKs when we're keeping track of MaxOutstandingSentPackets packets", func() { It("allows sending of ACKs when we're keeping track of MaxOutstandingSentPackets packets", func() {
handler.ReceivedPacket(protocol.EncryptionHandshake) handler.ReceivedPacket(protocol.EncryptionHandshake)
cong.EXPECT().CanSend(gomock.Any()).Return(true).AnyTimes() cong.EXPECT().CanSend(gomock.Any()).Return(true).AnyTimes()
cong.EXPECT().HasPacingBudget().Return(true).AnyTimes() cong.EXPECT().HasPacingBudget(gomock.Any()).Return(true).AnyTimes()
cong.EXPECT().OnPacketSent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() cong.EXPECT().OnPacketSent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes()
for i := protocol.PacketNumber(0); i < protocol.MaxOutstandingSentPackets; i++ { for i := protocol.PacketNumber(0); i < protocol.MaxOutstandingSentPackets; i++ {
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: i})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: i}))
} }
Expect(handler.SendMode()).To(Equal(SendAck)) Expect(handler.SendMode(time.Now())).To(Equal(SendAck))
}) })
It("allows PTOs, even when congestion limited", func() { It("allows PTOs, even when congestion limited", func() {
@ -630,14 +630,7 @@ var _ = Describe("SentPacketHandler", func() {
// that means retransmissions are sent without considering the congestion window // that means retransmissions are sent without considering the congestion window
handler.numProbesToSend = 1 handler.numProbesToSend = 1
handler.ptoMode = SendPTOHandshake handler.ptoMode = SendPTOHandshake
Expect(handler.SendMode()).To(Equal(SendPTOHandshake)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake))
})
It("says if it has pacing budget", func() {
cong.EXPECT().HasPacingBudget().Return(true)
Expect(handler.HasPacingBudget()).To(BeTrue())
cong.EXPECT().HasPacingBudget().Return(false)
Expect(handler.HasPacingBudget()).To(BeFalse())
}) })
It("returns the pacing delay", func() { It("returns the pacing delay", func() {
@ -660,7 +653,7 @@ var _ = Describe("SentPacketHandler", func() {
It("does nothing on OnAlarm if there are no outstanding packets", func() { It("does nothing on OnAlarm if there are no outstanding packets", func() {
handler.ReceivedPacket(protocol.EncryptionHandshake) handler.ReceivedPacket(protocol.EncryptionHandshake)
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
Context("probe packets", func() { Context("probe packets", func() {
@ -708,7 +701,7 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)}))
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second)) Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
Expect(handler.ptoCount).To(BeEquivalentTo(1)) Expect(handler.ptoCount).To(BeEquivalentTo(1))
_, err := handler.ReceivedAck(&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}, protocol.Encryption1RTT, time.Now()) _, err := handler.ReceivedAck(&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}, protocol.Encryption1RTT, time.Now())
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
@ -741,13 +734,13 @@ var _ = Describe("SentPacketHandler", func() {
// PTO timer based on the Handshake packet // PTO timer based on the Handshake packet
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.ptoCount).To(BeEquivalentTo(1)) Expect(handler.ptoCount).To(BeEquivalentTo(1))
Expect(handler.SendMode()).To(Equal(SendPTOHandshake)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake))
Expect(handler.GetLossDetectionTimeout()).To(Equal(sendTimeHandshake.Add(handler.rttStats.PTO(false) << 1))) Expect(handler.GetLossDetectionTimeout()).To(Equal(sendTimeHandshake.Add(handler.rttStats.PTO(false) << 1)))
handler.SetHandshakeConfirmed() handler.SetHandshakeConfirmed()
handler.DropPackets(protocol.EncryptionHandshake) handler.DropPackets(protocol.EncryptionHandshake)
// PTO timer based on the 1-RTT packet // PTO timer based on the 1-RTT packet
Expect(handler.GetLossDetectionTimeout()).To(Equal(sendTimeAppData.Add(handler.rttStats.PTO(true)))) // no backoff. PTO count = 0 Expect(handler.GetLossDetectionTimeout()).To(Equal(sendTimeAppData.Add(handler.rttStats.PTO(true)))) // no backoff. PTO count = 0
Expect(handler.SendMode()).ToNot(Equal(SendPTOHandshake)) Expect(handler.SendMode(time.Now())).ToNot(Equal(SendPTOHandshake))
Expect(handler.ptoCount).To(BeZero()) Expect(handler.ptoCount).To(BeZero())
}) })
@ -763,11 +756,11 @@ var _ = Describe("SentPacketHandler", func() {
}, },
})) }))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2}))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 3})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 3}))
Expect(handler.SendMode()).ToNot(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).ToNot(Equal(SendPTOAppData))
}) })
It("skips a packet number for 1-RTT PTOs", func() { It("skips a packet number for 1-RTT PTOs", func() {
@ -783,7 +776,7 @@ var _ = Describe("SentPacketHandler", func() {
}, },
})) }))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
// The packet number generator might have introduced another skipped a packet number. // The packet number generator might have introduced another skipped a packet number.
Expect(handler.PopPacketNumber(protocol.Encryption1RTT)).To(BeNumerically(">=", pn+2)) Expect(handler.PopPacketNumber(protocol.Encryption1RTT)).To(BeNumerically(">=", pn+2))
}) })
@ -793,15 +786,15 @@ var _ = Describe("SentPacketHandler", func() {
handler.SetHandshakeConfirmed() handler.SetHandshakeConfirmed()
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)}))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2}))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
for p := protocol.PacketNumber(3); p < 30; p++ { for p := protocol.PacketNumber(3); p < 30; p++ {
handler.SentPacket(nonAckElicitingPacket(&Packet{PacketNumber: p})) handler.SentPacket(nonAckElicitingPacket(&Packet{PacketNumber: p}))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
} }
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 30})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 30}))
Expect(handler.SendMode()).ToNot(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).ToNot(Equal(SendPTOAppData))
}) })
It("gets two probe packets if PTO expires", func() { It("gets two probe packets if PTO expires", func() {
@ -815,19 +808,19 @@ var _ = Describe("SentPacketHandler", func() {
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) // TLP Expect(handler.OnLossDetectionTimeout()).To(Succeed()) // TLP
Expect(handler.ptoCount).To(BeEquivalentTo(1)) Expect(handler.ptoCount).To(BeEquivalentTo(1))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 3})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 3}))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 4})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 4}))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) // PTO Expect(handler.OnLossDetectionTimeout()).To(Succeed()) // PTO
Expect(handler.ptoCount).To(BeEquivalentTo(2)) Expect(handler.ptoCount).To(BeEquivalentTo(2))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 5})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 5}))
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 6})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 6}))
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
It("gets two probe packets if PTO expires, for Handshake packets", func() { It("gets two probe packets if PTO expires, for Handshake packets", func() {
@ -839,12 +832,12 @@ var _ = Describe("SentPacketHandler", func() {
Expect(handler.initialPackets.lossTime.IsZero()).To(BeTrue()) Expect(handler.initialPackets.lossTime.IsZero()).To(BeTrue())
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOInitial)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial))
handler.SentPacket(initialPacket(&Packet{PacketNumber: 3})) handler.SentPacket(initialPacket(&Packet{PacketNumber: 3}))
Expect(handler.SendMode()).To(Equal(SendPTOInitial)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial))
handler.SentPacket(initialPacket(&Packet{PacketNumber: 4})) handler.SentPacket(initialPacket(&Packet{PacketNumber: 4}))
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
It("doesn't send 1-RTT probe packets before the handshake completes", func() { It("doesn't send 1-RTT probe packets before the handshake completes", func() {
@ -853,11 +846,11 @@ var _ = Describe("SentPacketHandler", func() {
updateRTT(time.Hour) updateRTT(time.Hour)
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.GetLossDetectionTimeout()).To(BeZero()) Expect(handler.GetLossDetectionTimeout()).To(BeZero())
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
handler.SetHandshakeConfirmed() handler.SetHandshakeConfirmed()
Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero())
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
}) })
It("resets the send mode when it receives an acknowledgement after queueing probe packets", func() { It("resets the send mode when it receives an acknowledgement after queueing probe packets", func() {
@ -866,11 +859,11 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)})) handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)}))
updateRTT(time.Second) updateRTT(time.Second)
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOAppData)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData))
ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}} ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}
_, err := handler.ReceivedAck(ack, protocol.Encryption1RTT, time.Now()) _, err := handler.ReceivedAck(ack, protocol.Encryption1RTT, time.Now())
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
It("handles ACKs for the original packet", func() { It("handles ACKs for the original packet", func() {
@ -902,7 +895,7 @@ var _ = Describe("SentPacketHandler", func() {
Frames: []Frame{{Frame: &wire.PingFrame{}}}, Frames: []Frame{{Frame: &wire.PingFrame{}}},
SendTime: now, SendTime: now,
}) })
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
handler.SentPacket(&Packet{ handler.SentPacket(&Packet{
PacketNumber: 2, PacketNumber: 2,
Length: 1, Length: 1,
@ -910,7 +903,7 @@ var _ = Describe("SentPacketHandler", func() {
Frames: []Frame{{Frame: &wire.PingFrame{}}}, Frames: []Frame{{Frame: &wire.PingFrame{}}},
SendTime: now, SendTime: now,
}) })
Expect(handler.SendMode()).To(Equal(SendNone)) Expect(handler.SendMode(time.Now())).To(Equal(SendNone))
}) })
It("cancels the loss detection timer when it is amplification limited, and resets it when becoming unblocked", func() { It("cancels the loss detection timer when it is amplification limited, and resets it when becoming unblocked", func() {
@ -964,7 +957,7 @@ var _ = Describe("SentPacketHandler", func() {
It("do not limits the window", func() { It("do not limits the window", func() {
handler.ReceivedBytes(0) handler.ReceivedBytes(0)
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
handler.SentPacket(&Packet{ handler.SentPacket(&Packet{
PacketNumber: 1, PacketNumber: 1,
Length: 900, Length: 900,
@ -972,7 +965,7 @@ var _ = Describe("SentPacketHandler", func() {
Frames: []Frame{{Frame: &wire.PingFrame{}}}, Frames: []Frame{{Frame: &wire.PingFrame{}}},
SendTime: time.Now(), SendTime: time.Now(),
}) })
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
}) })
@ -993,11 +986,11 @@ var _ = Describe("SentPacketHandler", func() {
// Make sure that a probe packet is sent. // Make sure that a probe packet is sent.
Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero())
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOInitial)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial))
// send a single packet to unblock the server // send a single packet to unblock the server
handler.SentPacket(initialPacket(&Packet{PacketNumber: 2})) handler.SentPacket(initialPacket(&Packet{PacketNumber: 2}))
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
// Now receive an ACK for a Handshake packet. // Now receive an ACK for a Handshake packet.
// This tells the client that the server completed address validation. // This tells the client that the server completed address validation.
@ -1024,7 +1017,7 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(handshakePacketNonAckEliciting(&Packet{PacketNumber: 1})) // also drops Initial packets handler.SentPacket(handshakePacketNonAckEliciting(&Packet{PacketNumber: 1})) // also drops Initial packets
Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero())
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOHandshake)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake))
// Now receive an ACK for this packet, and send another one. // Now receive an ACK for this packet, and send another one.
_, err = handler.ReceivedAck( _, err = handler.ReceivedAck(
@ -1041,7 +1034,7 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(handshakePacket(&Packet{PacketNumber: 1})) handler.SentPacket(handshakePacket(&Packet{PacketNumber: 1}))
Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero())
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOHandshake)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake))
// confirm the handshake // confirm the handshake
handler.DropPackets(protocol.EncryptionHandshake) handler.DropPackets(protocol.EncryptionHandshake)
Expect(handler.GetLossDetectionTimeout()).To(BeZero()) Expect(handler.GetLossDetectionTimeout()).To(BeZero())
@ -1071,7 +1064,7 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(initialPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)})) handler.SentPacket(initialPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)}))
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second)) Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOInitial)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial))
Expect(handler.ptoCount).To(BeEquivalentTo(1)) Expect(handler.ptoCount).To(BeEquivalentTo(1))
_, err := handler.ReceivedAck(&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}, protocol.EncryptionInitial, time.Now()) _, err := handler.ReceivedAck(&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}, protocol.EncryptionInitial, time.Now())
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
@ -1124,12 +1117,12 @@ var _ = Describe("SentPacketHandler", func() {
// Packet 1 should be considered lost (1+1/8) RTTs after it was sent. // Packet 1 should be considered lost (1+1/8) RTTs after it was sent.
Expect(handler.GetLossDetectionTimeout().Sub(getPacket(1, protocol.Encryption1RTT).SendTime)).To(Equal(time.Second * 9 / 8)) Expect(handler.GetLossDetectionTimeout().Sub(getPacket(1, protocol.Encryption1RTT).SendTime)).To(Equal(time.Second * 9 / 8))
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.Encryption1RTT) expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.Encryption1RTT)
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
expectInPacketHistory([]protocol.PacketNumber{3}, protocol.Encryption1RTT) expectInPacketHistory([]protocol.PacketNumber{3}, protocol.Encryption1RTT)
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
It("sets the early retransmit alarm for crypto packets", func() { It("sets the early retransmit alarm for crypto packets", func() {
@ -1147,12 +1140,12 @@ var _ = Describe("SentPacketHandler", func() {
// Packet 1 should be considered lost (1+1/8) RTTs after it was sent. // Packet 1 should be considered lost (1+1/8) RTTs after it was sent.
Expect(handler.GetLossDetectionTimeout().Sub(getPacket(1, protocol.EncryptionInitial).SendTime)).To(Equal(time.Second * 9 / 8)) Expect(handler.GetLossDetectionTimeout().Sub(getPacket(1, protocol.EncryptionInitial).SendTime)).To(Equal(time.Second * 9 / 8))
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.EncryptionInitial) expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.EncryptionInitial)
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
expectInPacketHistory([]protocol.PacketNumber{3}, protocol.EncryptionInitial) expectInPacketHistory([]protocol.PacketNumber{3}, protocol.EncryptionInitial)
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
It("sets the early retransmit alarm for Path MTU probe packets", func() { It("sets the early retransmit alarm for Path MTU probe packets", func() {
@ -1288,11 +1281,11 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(handshakePacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)})) handler.SentPacket(handshakePacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)}))
Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second)) Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOHandshake)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake))
Expect(handler.ptoCount).To(BeEquivalentTo(1)) Expect(handler.ptoCount).To(BeEquivalentTo(1))
handler.DropPackets(protocol.EncryptionHandshake) handler.DropPackets(protocol.EncryptionHandshake)
Expect(handler.ptoCount).To(BeZero()) Expect(handler.ptoCount).To(BeZero())
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
}) })
}) })
@ -1330,13 +1323,13 @@ var _ = Describe("SentPacketHandler", func() {
handler.SentPacket(initialPacket(&Packet{PacketNumber: 42})) handler.SentPacket(initialPacket(&Packet{PacketNumber: 42}))
Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero())
Expect(handler.bytesInFlight).ToNot(BeZero()) Expect(handler.bytesInFlight).ToNot(BeZero())
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
// now receive a Retry // now receive a Retry
Expect(handler.ResetForRetry()).To(Succeed()) Expect(handler.ResetForRetry()).To(Succeed())
Expect(lostPackets).To(Equal([]protocol.PacketNumber{42})) Expect(lostPackets).To(Equal([]protocol.PacketNumber{42}))
Expect(handler.bytesInFlight).To(BeZero()) Expect(handler.bytesInFlight).To(BeZero())
Expect(handler.GetLossDetectionTimeout()).To(BeZero()) Expect(handler.GetLossDetectionTimeout()).To(BeZero())
Expect(handler.SendMode()).To(Equal(SendAny)) Expect(handler.SendMode(time.Now())).To(Equal(SendAny))
Expect(handler.ptoCount).To(BeZero()) Expect(handler.ptoCount).To(BeZero())
}) })
@ -1407,7 +1400,7 @@ var _ = Describe("SentPacketHandler", func() {
SendTime: time.Now().Add(-800 * time.Millisecond), SendTime: time.Now().Add(-800 * time.Millisecond),
})) }))
Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.OnLossDetectionTimeout()).To(Succeed())
Expect(handler.SendMode()).To(Equal(SendPTOInitial)) Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial))
handler.SentPacket(ackElicitingPacket(&Packet{ handler.SentPacket(ackElicitingPacket(&Packet{
PacketNumber: 43, PacketNumber: 43,
EncryptionLevel: protocol.EncryptionInitial, EncryptionLevel: protocol.EncryptionInitial,

View file

@ -120,8 +120,8 @@ func (c *cubicSender) TimeUntilSend(_ protocol.ByteCount) time.Time {
return c.pacer.TimeUntilSend() return c.pacer.TimeUntilSend()
} }
func (c *cubicSender) HasPacingBudget() bool { func (c *cubicSender) HasPacingBudget(now time.Time) bool {
return c.pacer.Budget(c.clock.Now()) >= c.maxDatagramSize return c.pacer.Budget(now) >= c.maxDatagramSize
} }
func (c *cubicSender) maxCongestionWindow() protocol.ByteCount { func (c *cubicSender) maxCongestionWindow() protocol.ByteCount {

View file

@ -9,7 +9,7 @@ import (
// A SendAlgorithm performs congestion control // A SendAlgorithm performs congestion control
type SendAlgorithm interface { type SendAlgorithm interface {
TimeUntilSend(bytesInFlight protocol.ByteCount) time.Time TimeUntilSend(bytesInFlight protocol.ByteCount) time.Time
HasPacingBudget() bool HasPacingBudget(now time.Time) bool
OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool) OnPacketSent(sentTime time.Time, bytesInFlight protocol.ByteCount, packetNumber protocol.PacketNumber, bytes protocol.ByteCount, isRetransmittable bool)
CanSend(bytesInFlight protocol.ByteCount) bool CanSend(bytesInFlight protocol.ByteCount) bool
MaybeExitSlowStart() MaybeExitSlowStart()

View file

@ -162,17 +162,17 @@ func (mr *MockSentPacketHandlerMockRecorder) ResetForRetry() *gomock.Call {
} }
// SendMode mocks base method. // SendMode mocks base method.
func (m *MockSentPacketHandler) SendMode() ackhandler.SendMode { func (m *MockSentPacketHandler) SendMode(arg0 time.Time) ackhandler.SendMode {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SendMode") ret := m.ctrl.Call(m, "SendMode", arg0)
ret0, _ := ret[0].(ackhandler.SendMode) ret0, _ := ret[0].(ackhandler.SendMode)
return ret0 return ret0
} }
// SendMode indicates an expected call of SendMode. // SendMode indicates an expected call of SendMode.
func (mr *MockSentPacketHandlerMockRecorder) SendMode() *gomock.Call { func (mr *MockSentPacketHandlerMockRecorder) SendMode(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMode", reflect.TypeOf((*MockSentPacketHandler)(nil).SendMode)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMode", reflect.TypeOf((*MockSentPacketHandler)(nil).SendMode), arg0)
} }
// SentPacket mocks base method. // SentPacket mocks base method.

View file

@ -64,17 +64,17 @@ func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) GetCongestionWindow() *go
} }
// HasPacingBudget mocks base method. // HasPacingBudget mocks base method.
func (m *MockSendAlgorithmWithDebugInfos) HasPacingBudget() bool { func (m *MockSendAlgorithmWithDebugInfos) HasPacingBudget(arg0 time.Time) bool {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HasPacingBudget") ret := m.ctrl.Call(m, "HasPacingBudget", arg0)
ret0, _ := ret[0].(bool) ret0, _ := ret[0].(bool)
return ret0 return ret0
} }
// HasPacingBudget indicates an expected call of HasPacingBudget. // HasPacingBudget indicates an expected call of HasPacingBudget.
func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) HasPacingBudget() *gomock.Call { func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) HasPacingBudget(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasPacingBudget", reflect.TypeOf((*MockSendAlgorithmWithDebugInfos)(nil).HasPacingBudget)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasPacingBudget", reflect.TypeOf((*MockSendAlgorithmWithDebugInfos)(nil).HasPacingBudget), arg0)
} }
// InRecovery mocks base method. // InRecovery mocks base method.