@@ -130,7 +130,7 @@ type bbrSender struct {
130130 // triggers PROBE_RTT mode) if no new value is sampled during that period.
131131 minRtt time.Duration
132132 // The time at which the current value of |min_rtt_| was assigned.
133- minRttTimestamp time .Time
133+ minRttTimestamp congestion .Time
134134
135135 // The maximum allowed number of bytes in flight.
136136 congestionWindow congestion.ByteCount
@@ -171,7 +171,7 @@ type bbrSender struct {
171171 // pacing gain cycle.
172172 cycleCurrentOffset int
173173 // The time at which the last pacing gain cycle was started.
174- lastCycleStart time .Time
174+ lastCycleStart congestion .Time
175175
176176 // Indicates whether the connection has reached the full bandwidth mode.
177177 isAtFullBandwidth bool
@@ -186,7 +186,7 @@ type bbrSender struct {
186186 // Time at which PROBE_RTT has to be exited. Setting it to zero indicates
187187 // that the time is yet unknown as the number of packets in flight has not
188188 // reached the required value.
189- exitProbeRttAt time .Time
189+ exitProbeRttAt congestion .Time
190190 // Indicates whether a round-trip has passed since PROBE_RTT became active.
191191 probeRttRoundPassed bool
192192
@@ -313,18 +313,18 @@ func (b *bbrSender) SetRTTStatsProvider(provider congestion.RTTStatsProvider) {
313313}
314314
315315// TimeUntilSend implements the SendAlgorithm interface.
316- func (b * bbrSender ) TimeUntilSend (bytesInFlight congestion.ByteCount ) time .Time {
316+ func (b * bbrSender ) TimeUntilSend (bytesInFlight congestion.ByteCount ) congestion .Time {
317317 return b .pacer .TimeUntilSend ()
318318}
319319
320320// HasPacingBudget implements the SendAlgorithm interface.
321- func (b * bbrSender ) HasPacingBudget (now time .Time ) bool {
321+ func (b * bbrSender ) HasPacingBudget (now congestion .Time ) bool {
322322 return b .pacer .Budget (now ) >= b .maxDatagramSize
323323}
324324
325325// OnPacketSent implements the SendAlgorithm interface.
326326func (b * bbrSender ) OnPacketSent (
327- sentTime time .Time ,
327+ sentTime congestion .Time ,
328328 bytesInFlight congestion.ByteCount ,
329329 packetNumber congestion.PacketNumber ,
330330 bytes congestion.ByteCount ,
@@ -353,7 +353,7 @@ func (b *bbrSender) MaybeExitSlowStart() {
353353}
354354
355355// OnPacketAcked implements the SendAlgorithm interface.
356- func (b * bbrSender ) OnPacketAcked (number congestion.PacketNumber , ackedBytes , priorInFlight congestion.ByteCount , eventTime time .Time ) {
356+ func (b * bbrSender ) OnPacketAcked (number congestion.PacketNumber , ackedBytes , priorInFlight congestion.ByteCount , eventTime congestion .Time ) {
357357 // Do nothing.
358358}
359359
@@ -407,7 +407,7 @@ func (b *bbrSender) OnCongestionEvent(number congestion.PacketNumber, lostBytes,
407407 // Do nothing.
408408}
409409
410- func (b * bbrSender ) OnCongestionEventEx (priorInFlight congestion.ByteCount , eventTime time .Time , ackedPackets []congestion.AckedPacketInfo , lostPackets []congestion.LostPacketInfo ) {
410+ func (b * bbrSender ) OnCongestionEventEx (priorInFlight congestion.ByteCount , eventTime congestion .Time , ackedPackets []congestion.AckedPacketInfo , lostPackets []congestion.LostPacketInfo ) {
411411 totalBytesAckedBefore := b .sampler .TotalBytesAcked ()
412412 totalBytesLostBefore := b .sampler .TotalBytesLost ()
413413
@@ -598,7 +598,7 @@ func (b *bbrSender) probeRttCongestionWindow() congestion.ByteCount {
598598 return b .minCongestionWindow
599599}
600600
601- func (b * bbrSender ) maybeUpdateMinRtt (now time .Time , sampleMinRtt time.Duration ) bool {
601+ func (b * bbrSender ) maybeUpdateMinRtt (now congestion .Time , sampleMinRtt time.Duration ) bool {
602602 // Do not expire min_rtt if none was ever available.
603603 minRttExpired := b .minRtt != 0 && now .After (b .minRttTimestamp .Add (minRttExpiry ))
604604 if minRttExpired || sampleMinRtt < b .minRtt || b .minRtt == 0 {
@@ -610,7 +610,7 @@ func (b *bbrSender) maybeUpdateMinRtt(now time.Time, sampleMinRtt time.Duration)
610610}
611611
612612// Enters the STARTUP mode.
613- func (b * bbrSender ) enterStartupMode (now time .Time ) {
613+ func (b * bbrSender ) enterStartupMode (now congestion .Time ) {
614614 b .mode = bbrModeStartup
615615 // b.maybeTraceStateChange(logging.CongestionStateStartup)
616616 b .pacingGain = b .highGain
@@ -622,7 +622,7 @@ func (b *bbrSender) enterStartupMode(now time.Time) {
622622}
623623
624624// Enters the PROBE_BW mode.
625- func (b * bbrSender ) enterProbeBandwidthMode (now time .Time ) {
625+ func (b * bbrSender ) enterProbeBandwidthMode (now congestion .Time ) {
626626 b .mode = bbrModeProbeBw
627627 // b.maybeTraceStateChange(logging.CongestionStateProbeBw)
628628 b .congestionWindowGain = b .congestionWindowGainConstant
@@ -655,7 +655,7 @@ func (b *bbrSender) updateRoundTripCounter(lastAckedPacket congestion.PacketNumb
655655}
656656
657657// Updates the current gain used in PROBE_BW mode.
658- func (b * bbrSender ) updateGainCyclePhase (now time .Time , priorInFlight congestion.ByteCount , hasLosses bool ) {
658+ func (b * bbrSender ) updateGainCyclePhase (now congestion .Time , priorInFlight congestion.ByteCount , hasLosses bool ) {
659659 // In most cases, the cycle is advanced after an RTT passes.
660660 shouldAdvanceGainCycling := now .After (b .lastCycleStart .Add (b .getMinRtt ()))
661661 // If the pacing gain is above 1.0, the connection is trying to probe the
@@ -722,7 +722,7 @@ func (b *bbrSender) maybeAppLimited(bytesInFlight congestion.ByteCount) {
722722
723723// Transitions from STARTUP to DRAIN and from DRAIN to PROBE_BW if
724724// appropriate.
725- func (b * bbrSender ) maybeExitStartupOrDrain (now time .Time ) {
725+ func (b * bbrSender ) maybeExitStartupOrDrain (now congestion .Time ) {
726726 if b .mode == bbrModeStartup && b .isAtFullBandwidth {
727727 b .mode = bbrModeDrain
728728 // b.maybeTraceStateChange(logging.CongestionStateDrain)
@@ -739,14 +739,14 @@ func (b *bbrSender) maybeExitStartupOrDrain(now time.Time) {
739739}
740740
741741// Decides whether to enter or exit PROBE_RTT.
742- func (b * bbrSender ) maybeEnterOrExitProbeRtt (now time .Time , isRoundStart , minRttExpired bool ) {
742+ func (b * bbrSender ) maybeEnterOrExitProbeRtt (now congestion .Time , isRoundStart , minRttExpired bool ) {
743743 if minRttExpired && ! b .exitingQuiescence && b .mode != bbrModeProbeRtt {
744744 b .mode = bbrModeProbeRtt
745745 // b.maybeTraceStateChange(logging.CongestionStateProbRtt)
746746 b .pacingGain = 1.0
747747 // Do not decide on the time to exit PROBE_RTT until the |bytes_in_flight|
748748 // is at the target small value.
749- b .exitProbeRttAt = time. Time {}
749+ b .exitProbeRttAt = 0
750750
751751 if b .debug {
752752 b .debugPrint ("BandwidthEstimate: %s, CongestionWindowGain: %.2f, PacingGain: %.2f, PacingRate: %s" ,
0 commit comments