forked from quic-go/quic-go
ackhandler: don't delay ACKs for Initial and Handshake packets (#4288)
* ackhandler: don't delay ACKs for Initial and Handshake packets * ackhandler: embed the receivedPacketHistory
This commit is contained in:
@@ -27,18 +27,6 @@ func MinTime(a, b time.Time) time.Time {
|
||||
return a
|
||||
}
|
||||
|
||||
// MinNonZeroTime returns the earlist time that is not time.Time{}
|
||||
// If both a and b are time.Time{}, it returns time.Time{}
|
||||
func MinNonZeroTime(a, b time.Time) time.Time {
|
||||
if a.IsZero() {
|
||||
return b
|
||||
}
|
||||
if b.IsZero() {
|
||||
return a
|
||||
}
|
||||
return MinTime(a, b)
|
||||
}
|
||||
|
||||
// MaxTime returns the later time
|
||||
func MaxTime(a, b time.Time) time.Time {
|
||||
if a.After(b) {
|
||||
|
||||
@@ -30,14 +30,4 @@ var _ = Describe("Min / Max", func() {
|
||||
Expect(MinNonZeroDuration(b, a)).To(Equal(b))
|
||||
Expect(MinNonZeroDuration(time.Minute, time.Hour)).To(Equal(time.Minute))
|
||||
})
|
||||
|
||||
It("returns the minium non-zero time", func() {
|
||||
a := time.Time{}
|
||||
b := time.Now()
|
||||
Expect(MinNonZeroTime(time.Time{}, time.Time{})).To(Equal(time.Time{}))
|
||||
Expect(MinNonZeroTime(a, b)).To(Equal(b))
|
||||
Expect(MinNonZeroTime(b, a)).To(Equal(b))
|
||||
Expect(MinNonZeroTime(b, b.Add(time.Second))).To(Equal(b))
|
||||
Expect(MinNonZeroTime(b.Add(time.Second), b)).To(Equal(b))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user