forked from quic-go/quic-go
stop the timer when the session's run loop returns
This commit is contained in:
@@ -46,3 +46,8 @@ func (t *Timer) Reset(deadline time.Time) {
|
||||
func (t *Timer) SetRead() {
|
||||
t.read = true
|
||||
}
|
||||
|
||||
// Stop stops the timer
|
||||
func (t *Timer) Stop() {
|
||||
t.t.Stop()
|
||||
}
|
||||
|
||||
@@ -77,4 +77,11 @@ var _ = Describe("Timer", func() {
|
||||
Eventually(t.Chan()).Should(Receive())
|
||||
Consistently(t.Chan()).ShouldNot(Receive())
|
||||
})
|
||||
|
||||
It("stops", func() {
|
||||
t := NewTimer()
|
||||
t.Reset(time.Now().Add(50 * time.Millisecond))
|
||||
t.Stop()
|
||||
Consistently(t.Chan()).ShouldNot(Receive())
|
||||
})
|
||||
})
|
||||
|
||||
@@ -605,6 +605,7 @@ runLoop:
|
||||
s.logger.Infof("Connection %s closed.", s.logID)
|
||||
s.cryptoStreamHandler.Close()
|
||||
s.sendQueue.Close()
|
||||
s.timer.Stop()
|
||||
return closeErr.err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user