diff --git a/connection.go b/connection.go index d94c4bf6..e081e45f 100644 --- a/connection.go +++ b/connection.go @@ -1730,12 +1730,13 @@ func (s *connection) applyTransportParameters() { func (s *connection) triggerSending() error { 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. switch sendMode { case ackhandler.SendAny: - return s.sendPackets() + return s.sendPackets(now) case ackhandler.SendNone: return nil case ackhandler.SendPacingLimited: @@ -1752,9 +1753,9 @@ func (s *connection) triggerSending() error { // We can at most send a single ACK only packet. // 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. - return s.maybeSendAckOnlyPacket() + return s.maybeSendAckOnlyPacket(now) case ackhandler.SendPTOInitial: - if err := s.sendProbePacket(protocol.EncryptionInitial); err != nil { + if err := s.sendProbePacket(protocol.EncryptionInitial, now); err != nil { return err } if s.sendQueue.WouldBlock() { @@ -1763,7 +1764,7 @@ func (s *connection) triggerSending() error { } return s.triggerSending() case ackhandler.SendPTOHandshake: - if err := s.sendProbePacket(protocol.EncryptionHandshake); err != nil { + if err := s.sendProbePacket(protocol.EncryptionHandshake, now); err != nil { return err } if s.sendQueue.WouldBlock() { @@ -1772,7 +1773,7 @@ func (s *connection) triggerSending() error { } return s.triggerSending() case ackhandler.SendPTOAppData: - if err := s.sendProbePacket(protocol.Encryption1RTT); err != nil { + if err := s.sendProbePacket(protocol.Encryption1RTT, now); err != nil { return err } if s.sendQueue.WouldBlock() { @@ -1785,8 +1786,7 @@ func (s *connection) triggerSending() error { } } -func (s *connection) sendPackets() error { - now := time.Now() +func (s *connection) sendPackets(now time.Time) error { // Path MTU Discovery // 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 @@ -1817,7 +1817,7 @@ func (s *connection) sendPackets() error { } s.sentFirstPacket = true s.sendPackedCoalescedPacket(packet, now) - sendMode := s.sentPacketHandler.SendMode() + sendMode := s.sentPacketHandler.SendMode(now) if sendMode == ackhandler.SendPacingLimited { s.resetPacingDeadline() } else if sendMode == ackhandler.SendAny { @@ -1848,7 +1848,7 @@ func (s *connection) sendPacketsWithoutGSO(now time.Time) error { if s.sendQueue.WouldBlock() { return nil } - sendMode := s.sentPacketHandler.SendMode() + sendMode := s.sentPacketHandler.SendMode(now) if sendMode == ackhandler.SendPacingLimited { s.resetPacingDeadline() return nil @@ -1883,7 +1883,7 @@ func (s *connection) sendPacketsWithGSO(now time.Time) error { } if !dontSendMore { - sendMode := s.sentPacketHandler.SendMode() + sendMode := s.sentPacketHandler.SendMode(now) if sendMode == ackhandler.SendPacingLimited { s.resetPacingDeadline() } @@ -1927,8 +1927,7 @@ func (s *connection) resetPacingDeadline() { s.pacingDeadline = deadline } -func (s *connection) maybeSendAckOnlyPacket() error { - now := time.Now() +func (s *connection) maybeSendAckOnlyPacket(now time.Time) error { if !s.handshakeConfirmed { packet, err := s.packer.PackCoalescedPacket(true, s.mtuDiscoverer.CurrentSize(), now, s.version) if err != nil { @@ -1954,8 +1953,7 @@ func (s *connection) maybeSendAckOnlyPacket() error { return nil } -func (s *connection) sendProbePacket(encLevel protocol.EncryptionLevel) error { - now := time.Now() +func (s *connection) sendProbePacket(encLevel protocol.EncryptionLevel, now time.Time) error { // Queue probe packets until we actually send out a packet, // or until there are no more packets to queue. var packet *coalescedPacket diff --git a/connection_test.go b/connection_test.go index c20284e3..339c2d3e 100644 --- a/connection_test.go +++ b/connection_test.go @@ -610,7 +610,7 @@ var _ = Describe("Connection", func() { conn.sendQueue = newSendQueue(sconn) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) 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 sph.EXPECT().SentPacket(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.EXPECT().TimeUntilSend().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()) conn.sentPacketHandler = sph runConn() @@ -1248,7 +1248,7 @@ var _ = Describe("Connection", func() { sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph.EXPECT().TimeUntilSend().AnyTimes() sph.EXPECT().GetLossDetectionTimeout().AnyTimes() - sph.EXPECT().SendMode().Return(ackhandler.SendAck) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAck) 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) }) conn.sentPacketHandler = sph @@ -1262,7 +1262,7 @@ var _ = Describe("Connection", func() { sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph.EXPECT().TimeUntilSend().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()) conn.sentPacketHandler = sph fc := mocks.NewMockConnectionFlowController(mockCtrl) @@ -1283,7 +1283,7 @@ var _ = Describe("Connection", func() { It("doesn't send when the SentPacketHandler doesn't allow it", func() { sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph.EXPECT().GetLossDetectionTimeout().AnyTimes() - sph.EXPECT().SendMode().Return(ackhandler.SendNone).AnyTimes() + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone).AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes() conn.sentPacketHandler = sph runConn() @@ -1317,8 +1317,8 @@ var _ = Describe("Connection", func() { sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes() - sph.EXPECT().SendMode().Return(sendMode) - sph.EXPECT().SendMode().Return(ackhandler.SendNone) + sph.EXPECT().SendMode(gomock.Any()).Return(sendMode) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone) sph.EXPECT().QueueProbePacket(encLevel) p := getCoalescedPacket(123, enc != protocol.Encryption1RTT) 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.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes() - sph.EXPECT().SendMode().Return(sendMode) - sph.EXPECT().SendMode().Return(ackhandler.SendNone) + sph.EXPECT().SendMode(gomock.Any()).Return(sendMode) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone) sph.EXPECT().QueueProbePacket(encLevel).Return(false) p := getCoalescedPacket(123, enc != protocol.Encryption1RTT) 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() { sph.EXPECT().SentPacket(gomock.Any()).Times(2) - sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(2) - sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(2) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited) 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: 11}}, []byte("packet11")) @@ -1427,7 +1427,7 @@ var _ = Describe("Connection", func() { It("sends multiple packets one by one immediately, with GSO", func() { enableGSO() 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()) rand.Read(payload1) 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() { enableGSO() sph.EXPECT().SentPacket(gomock.Any()).Times(2) - sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(2) - sph.EXPECT().SendMode().Return(ackhandler.SendNone) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(2) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone) payload1 := make([]byte, conn.mtuDiscoverer.CurrentSize()) rand.Read(payload1) 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() { 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")) packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) sender.EXPECT().WouldBlock().AnyTimes() @@ -1491,7 +1491,7 @@ var _ = Describe("Connection", func() { It("allows an ACK to be sent when pacing limited", func() { sph.EXPECT().SentPacket(gomock.Any()) 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) sender.EXPECT().WouldBlock().AnyTimes() @@ -1509,8 +1509,8 @@ var _ = Describe("Connection", func() { // we shouldn't send the ACK in the same run It("doesn't send an ACK right after becoming congestion limited", func() { sph.EXPECT().SentPacket(gomock.Any()) - sph.EXPECT().SendMode().Return(ackhandler.SendAny) - sph.EXPECT().SendMode().Return(ackhandler.SendAck) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAck) expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 100}}, []byte("packet100")) sender.EXPECT().WouldBlock().AnyTimes() sender.EXPECT().Send(gomock.Any(), gomock.Any()) @@ -1526,15 +1526,15 @@ var _ = Describe("Connection", func() { It("paces packets", func() { pacingDelay := scaleDuration(100 * time.Millisecond) 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")), 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().SendMode().Return(ackhandler.SendAny), + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny), expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 101}}, []byte("packet101")), 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)), ) written := make(chan struct{}, 2) @@ -1553,8 +1553,8 @@ var _ = Describe("Connection", func() { It("sends multiple packets at once", func() { sph.EXPECT().SentPacket(gomock.Any()).Times(3) - sph.EXPECT().SendMode().Return(ackhandler.SendAny).Times(3) - sph.EXPECT().SendMode().Return(ackhandler.SendPacingLimited) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).Times(3) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendPacingLimited) sph.EXPECT().TimeUntilSend().Return(time.Now().Add(time.Hour)) for pn := protocol.PacketNumber(1000); pn < 1003; pn++ { expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: pn}}, []byte("packet")) @@ -1591,7 +1591,7 @@ var _ = Describe("Connection", func() { written := make(chan struct{}) sender.EXPECT().WouldBlock().AnyTimes() 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")) 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) }) @@ -1614,7 +1614,7 @@ var _ = Describe("Connection", func() { sph.EXPECT().ReceivedBytes(gomock.Any()) 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")) 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) }) @@ -1627,7 +1627,7 @@ var _ = Describe("Connection", func() { It("stops sending when the send queue is full", func() { 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")) written := make(chan struct{}, 1) sender.EXPECT().WouldBlock() @@ -1646,7 +1646,7 @@ var _ = Describe("Connection", func() { // now make room in the send queue 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() expectAppendPacket(packer, shortHeaderPacket{Packet: &ackhandler.Packet{PacketNumber: 1001}}, []byte("packet1001")) 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() { - sph.EXPECT().SendMode().Return(ackhandler.SendAny).AnyTimes() + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny).AnyTimes() sender.EXPECT().WouldBlock().AnyTimes() packer.EXPECT().AppendPacket(gomock.Any(), gomock.Any(), gomock.Any(), conn.version).Return(shortHeaderPacket{}, errNothingToPack) // don't EXPECT any calls to mconn.Write() @@ -1678,8 +1678,8 @@ var _ = Describe("Connection", func() { conn.mtuDiscoverer = mtuDiscoverer conn.config.DisablePathMTUDiscovery = false sph.EXPECT().SentPacket(gomock.Any()) - sph.EXPECT().SendMode().Return(ackhandler.SendAny) - sph.EXPECT().SendMode().Return(ackhandler.SendNone) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendAny) + sph.EXPECT().SendMode(gomock.Any()).Return(ackhandler.SendNone) written := make(chan struct{}, 1) sender.EXPECT().WouldBlock().AnyTimes() 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.EXPECT().GetLossDetectionTimeout().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()) 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) sph := mockackhandler.NewMockSentPacketHandler(mockCtrl) 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) { 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() 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() gomock.InOrder( sph.EXPECT().SentPacket(gomock.Any()).Do(func(p *ackhandler.Packet) { @@ -1860,7 +1860,7 @@ var _ = Describe("Connection", func() { conn.sentPacketHandler = sph sph.EXPECT().GetLossDetectionTimeout().AnyTimes() sph.EXPECT().TimeUntilSend().AnyTimes() - sph.EXPECT().SendMode().AnyTimes() + sph.EXPECT().SendMode(gomock.Any()).AnyTimes() sph.EXPECT().SetHandshakeConfirmed() connRunner.EXPECT().Retire(clientDestConnID) go func() { @@ -1956,7 +1956,7 @@ var _ = Describe("Connection", func() { It("sends a HANDSHAKE_DONE frame when the handshake completes", func() { 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().TimeUntilSend().AnyTimes() sph.EXPECT().SetHandshakeConfirmed() diff --git a/internal/ackhandler/interfaces.go b/internal/ackhandler/interfaces.go index 01ee72c1..8178ca75 100644 --- a/internal/ackhandler/interfaces.go +++ b/internal/ackhandler/interfaces.go @@ -20,7 +20,7 @@ type SentPacketHandler interface { SetHandshakeConfirmed() // 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. // It is used for pacing packets. TimeUntilSend() time.Time diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go index 05467a04..1cb130c1 100644 --- a/internal/ackhandler/sent_packet_handler.go +++ b/internal/ackhandler/sent_packet_handler.go @@ -717,7 +717,7 @@ func (h *sentPacketHandler) PopPacketNumber(encLevel protocol.EncryptionLevel) p return h.getPacketNumberSpace(encLevel).pns.Pop() } -func (h *sentPacketHandler) SendMode() SendMode { +func (h *sentPacketHandler) SendMode(now time.Time) SendMode { numTrackedPackets := h.appDataPackets.history.Len() if h.initialPackets != nil { numTrackedPackets += h.initialPackets.history.Len() @@ -756,7 +756,7 @@ func (h *sentPacketHandler) SendMode() SendMode { } return SendAck } - if !h.congestion.HasPacingBudget() { + if !h.congestion.HasPacingBudget(now) { return SendPacingLimited } return SendAny @@ -766,10 +766,6 @@ func (h *sentPacketHandler) TimeUntilSend() time.Time { return h.congestion.TimeUntilSend(h.bytesInFlight) } -func (h *sentPacketHandler) HasPacingBudget() bool { - return h.congestion.HasPacingBudget() -} - func (h *sentPacketHandler) SetMaxDatagramSize(s protocol.ByteCount) { h.congestion.SetMaxDatagramSize(s) } diff --git a/internal/ackhandler/sent_packet_handler_test.go b/internal/ackhandler/sent_packet_handler_test.go index d0385b9f..20bbde05 100644 --- a/internal/ackhandler/sent_packet_handler_test.go +++ b/internal/ackhandler/sent_packet_handler_test.go @@ -599,29 +599,29 @@ var _ = Describe("SentPacketHandler", func() { SendTime: time.Now(), }) cong.EXPECT().CanSend(protocol.ByteCount(42)).Return(true) - cong.EXPECT().HasPacingBudget().Return(true) - handler.SendMode() + cong.EXPECT().HasPacingBudget(gomock.Any()).Return(true) + handler.SendMode(time.Now()) }) It("allows sending of ACKs when congestion limited", func() { handler.ReceivedPacket(protocol.EncryptionHandshake) cong.EXPECT().CanSend(gomock.Any()).Return(true) - cong.EXPECT().HasPacingBudget().Return(true) - Expect(handler.SendMode()).To(Equal(SendAny)) + cong.EXPECT().HasPacingBudget(gomock.Any()).Return(true) + Expect(handler.SendMode(time.Now())).To(Equal(SendAny)) 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() { handler.ReceivedPacket(protocol.EncryptionHandshake) 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() 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})) } - Expect(handler.SendMode()).To(Equal(SendAck)) + Expect(handler.SendMode(time.Now())).To(Equal(SendAck)) }) 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 handler.numProbesToSend = 1 handler.ptoMode = SendPTOHandshake - Expect(handler.SendMode()).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()) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake)) }) 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() { handler.ReceivedPacket(protocol.EncryptionHandshake) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) - Expect(handler.SendMode()).To(Equal(SendAny)) + Expect(handler.SendMode(time.Now())).To(Equal(SendAny)) }) Context("probe packets", func() { @@ -708,7 +701,7 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)})) Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second)) 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)) _, err := handler.ReceivedAck(&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}, protocol.Encryption1RTT, time.Now()) Expect(err).ToNot(HaveOccurred()) @@ -741,13 +734,13 @@ var _ = Describe("SentPacketHandler", func() { // PTO timer based on the Handshake packet Expect(handler.OnLossDetectionTimeout()).To(Succeed()) 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))) handler.SetHandshakeConfirmed() handler.DropPackets(protocol.EncryptionHandshake) // 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.SendMode()).ToNot(Equal(SendPTOHandshake)) + Expect(handler.SendMode(time.Now())).ToNot(Equal(SendPTOHandshake)) Expect(handler.ptoCount).To(BeZero()) }) @@ -763,11 +756,11 @@ var _ = Describe("SentPacketHandler", func() { }, })) 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})) - Expect(handler.SendMode()).To(Equal(SendPTOAppData)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData)) 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() { @@ -783,7 +776,7 @@ var _ = Describe("SentPacketHandler", func() { }, })) 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. Expect(handler.PopPacketNumber(protocol.Encryption1RTT)).To(BeNumerically(">=", pn+2)) }) @@ -793,15 +786,15 @@ var _ = Describe("SentPacketHandler", func() { handler.SetHandshakeConfirmed() handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)})) 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})) - Expect(handler.SendMode()).To(Equal(SendPTOAppData)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData)) for p := protocol.PacketNumber(3); p < 30; 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})) - Expect(handler.SendMode()).ToNot(Equal(SendPTOAppData)) + Expect(handler.SendMode(time.Now())).ToNot(Equal(SendPTOAppData)) }) 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.ptoCount).To(BeEquivalentTo(1)) - Expect(handler.SendMode()).To(Equal(SendPTOAppData)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData)) 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})) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) // PTO 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})) - Expect(handler.SendMode()).To(Equal(SendPTOAppData)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOAppData)) 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() { @@ -839,12 +832,12 @@ var _ = Describe("SentPacketHandler", func() { Expect(handler.initialPackets.lossTime.IsZero()).To(BeTrue()) 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})) - Expect(handler.SendMode()).To(Equal(SendPTOInitial)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial)) 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() { @@ -853,11 +846,11 @@ var _ = Describe("SentPacketHandler", func() { updateRTT(time.Hour) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) Expect(handler.GetLossDetectionTimeout()).To(BeZero()) - Expect(handler.SendMode()).To(Equal(SendAny)) + Expect(handler.SendMode(time.Now())).To(Equal(SendAny)) handler.SetHandshakeConfirmed() Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) 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() { @@ -866,11 +859,11 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(ackElicitingPacket(&Packet{PacketNumber: 1, SendTime: time.Now().Add(-time.Hour)})) updateRTT(time.Second) 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}}} _, err := handler.ReceivedAck(ack, protocol.Encryption1RTT, time.Now()) 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() { @@ -902,7 +895,7 @@ var _ = Describe("SentPacketHandler", func() { Frames: []Frame{{Frame: &wire.PingFrame{}}}, SendTime: now, }) - Expect(handler.SendMode()).To(Equal(SendAny)) + Expect(handler.SendMode(time.Now())).To(Equal(SendAny)) handler.SentPacket(&Packet{ PacketNumber: 2, Length: 1, @@ -910,7 +903,7 @@ var _ = Describe("SentPacketHandler", func() { Frames: []Frame{{Frame: &wire.PingFrame{}}}, 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() { @@ -964,7 +957,7 @@ var _ = Describe("SentPacketHandler", func() { It("do not limits the window", func() { handler.ReceivedBytes(0) - Expect(handler.SendMode()).To(Equal(SendAny)) + Expect(handler.SendMode(time.Now())).To(Equal(SendAny)) handler.SentPacket(&Packet{ PacketNumber: 1, Length: 900, @@ -972,7 +965,7 @@ var _ = Describe("SentPacketHandler", func() { Frames: []Frame{{Frame: &wire.PingFrame{}}}, 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. Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) 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 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. // 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 Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) 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. _, err = handler.ReceivedAck( @@ -1041,7 +1034,7 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(handshakePacket(&Packet{PacketNumber: 1})) Expect(handler.GetLossDetectionTimeout()).ToNot(BeZero()) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) - Expect(handler.SendMode()).To(Equal(SendPTOHandshake)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOHandshake)) // confirm the handshake handler.DropPackets(protocol.EncryptionHandshake) Expect(handler.GetLossDetectionTimeout()).To(BeZero()) @@ -1071,7 +1064,7 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(initialPacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)})) Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second)) 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)) _, err := handler.ReceivedAck(&wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 1, Largest: 1}}}, protocol.EncryptionInitial, time.Now()) 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. 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) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) 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() { @@ -1147,12 +1140,12 @@ var _ = Describe("SentPacketHandler", func() { // 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.SendMode()).To(Equal(SendAny)) + Expect(handler.SendMode(time.Now())).To(Equal(SendAny)) expectInPacketHistory([]protocol.PacketNumber{1, 3}, protocol.EncryptionInitial) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) 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() { @@ -1288,11 +1281,11 @@ var _ = Describe("SentPacketHandler", func() { handler.SentPacket(handshakePacket(&Packet{PacketNumber: 2, SendTime: now.Add(-time.Minute)})) Expect(handler.GetLossDetectionTimeout()).To(BeTemporally("~", now.Add(-time.Minute), time.Second)) 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)) handler.DropPackets(protocol.EncryptionHandshake) 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})) Expect(handler.GetLossDetectionTimeout()).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 Expect(handler.ResetForRetry()).To(Succeed()) Expect(lostPackets).To(Equal([]protocol.PacketNumber{42})) Expect(handler.bytesInFlight).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()) }) @@ -1407,7 +1400,7 @@ var _ = Describe("SentPacketHandler", func() { SendTime: time.Now().Add(-800 * time.Millisecond), })) Expect(handler.OnLossDetectionTimeout()).To(Succeed()) - Expect(handler.SendMode()).To(Equal(SendPTOInitial)) + Expect(handler.SendMode(time.Now())).To(Equal(SendPTOInitial)) handler.SentPacket(ackElicitingPacket(&Packet{ PacketNumber: 43, EncryptionLevel: protocol.EncryptionInitial, diff --git a/internal/congestion/cubic_sender.go b/internal/congestion/cubic_sender.go index dac3118e..2e508475 100644 --- a/internal/congestion/cubic_sender.go +++ b/internal/congestion/cubic_sender.go @@ -120,8 +120,8 @@ func (c *cubicSender) TimeUntilSend(_ protocol.ByteCount) time.Time { return c.pacer.TimeUntilSend() } -func (c *cubicSender) HasPacingBudget() bool { - return c.pacer.Budget(c.clock.Now()) >= c.maxDatagramSize +func (c *cubicSender) HasPacingBudget(now time.Time) bool { + return c.pacer.Budget(now) >= c.maxDatagramSize } func (c *cubicSender) maxCongestionWindow() protocol.ByteCount { diff --git a/internal/congestion/interface.go b/internal/congestion/interface.go index 5db3ebae..484bd5f8 100644 --- a/internal/congestion/interface.go +++ b/internal/congestion/interface.go @@ -9,7 +9,7 @@ import ( // A SendAlgorithm performs congestion control type SendAlgorithm interface { 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) CanSend(bytesInFlight protocol.ByteCount) bool MaybeExitSlowStart() diff --git a/internal/mocks/ackhandler/sent_packet_handler.go b/internal/mocks/ackhandler/sent_packet_handler.go index d538cf81..8df56ac4 100644 --- a/internal/mocks/ackhandler/sent_packet_handler.go +++ b/internal/mocks/ackhandler/sent_packet_handler.go @@ -162,17 +162,17 @@ func (mr *MockSentPacketHandlerMockRecorder) ResetForRetry() *gomock.Call { } // SendMode mocks base method. -func (m *MockSentPacketHandler) SendMode() ackhandler.SendMode { +func (m *MockSentPacketHandler) SendMode(arg0 time.Time) ackhandler.SendMode { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SendMode") + ret := m.ctrl.Call(m, "SendMode", arg0) ret0, _ := ret[0].(ackhandler.SendMode) return ret0 } // 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() - 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. diff --git a/internal/mocks/congestion.go b/internal/mocks/congestion.go index a2d61f46..6a5e46ad 100644 --- a/internal/mocks/congestion.go +++ b/internal/mocks/congestion.go @@ -64,17 +64,17 @@ func (mr *MockSendAlgorithmWithDebugInfosMockRecorder) GetCongestionWindow() *go } // HasPacingBudget mocks base method. -func (m *MockSendAlgorithmWithDebugInfos) HasPacingBudget() bool { +func (m *MockSendAlgorithmWithDebugInfos) HasPacingBudget(arg0 time.Time) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "HasPacingBudget") + ret := m.ctrl.Call(m, "HasPacingBudget", arg0) ret0, _ := ret[0].(bool) return ret0 } // 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() - 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.