forked from quic-go/quic-go
use a monotonous timer for the connection (#3570)
There's no point in having the timer fire multiple times for the same timestamp. By using a monotonuos timer we avoid busy-looping in cases where the timer fires, but we can't actually send a packet.
This commit is contained in:
@@ -21,6 +21,14 @@ var _ = Describe("Timer", func() {
|
||||
Eventually(t.Chan()).Should(Receive())
|
||||
})
|
||||
|
||||
It("returns the deadline", func() {
|
||||
t := NewTimer()
|
||||
deadline := time.Now().Add(d)
|
||||
t.Reset(deadline)
|
||||
Expect(t.Deadline()).To(Equal(deadline))
|
||||
Eventually(t.Chan()).Should(Receive())
|
||||
})
|
||||
|
||||
It("works multiple times with reading", func() {
|
||||
t := NewTimer()
|
||||
for i := 0; i < 10; i++ {
|
||||
|
||||
Reference in New Issue
Block a user