55 "time"
66
77 "github.com/metacubex/quic-go/congestion"
8+ "github.com/metacubex/quic-go/monotime"
89)
910
1011var (
@@ -36,18 +37,18 @@ type SendTimeState struct {
3637type ConnectionStateOnSentPacket struct {
3738 packetNumber congestion.PacketNumber
3839 // Time at which the packet is sent.
39- sendTime time .Time
40+ sendTime monotime .Time
4041 // Size of the packet.
4142 size congestion.ByteCount
4243 // The value of |totalBytesSentAtLastAckedPacket| at the time the
4344 // packet was sent.
4445 totalBytesSentAtLastAckedPacket congestion.ByteCount
4546 // The value of |lastAckedPacketSentTime| at the time the packet was
4647 // sent.
47- lastAckedPacketSentTime time .Time
48+ lastAckedPacketSentTime monotime .Time
4849 // The value of |lastAckedPacketAckTime| at the time the packet was
4950 // sent.
50- lastAckedPacketAckTime time .Time
51+ lastAckedPacketAckTime monotime .Time
5152 // Send time states that are returned to the congestion controller when the
5253 // packet is acked or lost.
5354 sendTimeState SendTimeState
@@ -166,9 +167,9 @@ type BandwidthSampler struct {
166167 totalBytesSentAtLastAckedPacket congestion.ByteCount
167168 // The time at which the last acknowledged packet was sent. Set to
168169 // QuicTime::Zero() if no valid timestamp is available.
169- lastAckedPacketSentTime time .Time
170+ lastAckedPacketSentTime monotime .Time
170171 // The time at which the most recent packet was acknowledged.
171- lastAckedPacketAckTime time .Time
172+ lastAckedPacketAckTime monotime .Time
172173 // The most recently sent packet.
173174 lastSendPacket congestion.PacketNumber
174175 // Indicates whether the bandwidth sampler is currently in an app-limited
@@ -194,7 +195,7 @@ func NewBandwidthSampler() *BandwidthSampler {
194195// packets are sent in order. The information about the packet will not be
195196// released from the sampler until it the packet is either acknowledged or
196197// declared lost.
197- func (s * BandwidthSampler ) OnPacketSent (sentTime time .Time , lastSentPacket congestion.PacketNumber , sentBytes , bytesInFlight congestion.ByteCount , hasRetransmittableData bool ) {
198+ func (s * BandwidthSampler ) OnPacketSent (sentTime monotime .Time , lastSentPacket congestion.PacketNumber , sentBytes , bytesInFlight congestion.ByteCount , hasRetransmittableData bool ) {
198199 s .lastSendPacket = lastSentPacket
199200
200201 if ! hasRetransmittableData {
@@ -224,7 +225,7 @@ func (s *BandwidthSampler) OnPacketSent(sentTime time.Time, lastSentPacket conge
224225// OnPacketAcked Notifies the sampler that the |lastAckedPacket| is acknowledged. Returns a
225226// bandwidth sample. If no bandwidth sample is available,
226227// QuicBandwidth::Zero() is returned.
227- func (s * BandwidthSampler ) OnPacketAcked (ackTime time .Time , lastAckedPacket congestion.PacketNumber ) * BandwidthSample {
228+ func (s * BandwidthSampler ) OnPacketAcked (ackTime monotime .Time , lastAckedPacket congestion.PacketNumber ) * BandwidthSample {
228229 sentPacketState := s .connectionStats .Get (lastAckedPacket )
229230 if sentPacketState == nil {
230231 return NewBandwidthSample ()
@@ -238,7 +239,7 @@ func (s *BandwidthSampler) OnPacketAcked(ackTime time.Time, lastAckedPacket cong
238239
239240// onPacketAckedInner Handles the actual bandwidth calculations, whereas the outer method handles
240241// retrieving and removing |sentPacket|.
241- func (s * BandwidthSampler ) onPacketAckedInner (ackTime time .Time , lastAckedPacket congestion.PacketNumber , sentPacket * ConnectionStateOnSentPacket ) * BandwidthSample {
242+ func (s * BandwidthSampler ) onPacketAckedInner (ackTime monotime .Time , lastAckedPacket congestion.PacketNumber , sentPacket * ConnectionStateOnSentPacket ) * BandwidthSample {
242243 s .totalBytesAcked += sentPacket .size
243244
244245 s .totalBytesSentAtLastAckedPacket = sentPacket .sendTimeState .totalBytesSent
@@ -336,7 +337,7 @@ type ConnectionStates struct {
336337 stats map [congestion.PacketNumber ]* ConnectionStateOnSentPacket
337338}
338339
339- func (s * ConnectionStates ) Insert (packetNumber congestion.PacketNumber , sentTime time .Time , bytes congestion.ByteCount , sampler * BandwidthSampler ) bool {
340+ func (s * ConnectionStates ) Insert (packetNumber congestion.PacketNumber , sentTime monotime .Time , bytes congestion.ByteCount , sampler * BandwidthSampler ) bool {
340341 if _ , ok := s .stats [packetNumber ]; ok {
341342 return false
342343 }
@@ -357,7 +358,7 @@ func (s *ConnectionStates) Remove(packetNumber congestion.PacketNumber) (bool, *
357358 return ok , state
358359}
359360
360- func NewConnectionStateOnSentPacket (packetNumber congestion.PacketNumber , sentTime time .Time , bytes congestion.ByteCount , sampler * BandwidthSampler ) * ConnectionStateOnSentPacket {
361+ func NewConnectionStateOnSentPacket (packetNumber congestion.PacketNumber , sentTime monotime .Time , bytes congestion.ByteCount , sampler * BandwidthSampler ) * ConnectionStateOnSentPacket {
361362 return & ConnectionStateOnSentPacket {
362363 packetNumber : packetNumber ,
363364 sendTime : sentTime ,
0 commit comments