Akash Reddy Kankanala | 92dfdf8 | 2025-03-23 22:07:09 +0530 | [diff] [blame^] | 1 | // Copyright 2024 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | package http2 |
| 5 | |
| 6 | import "time" |
| 7 | |
| 8 | // A timer is a time.Timer, as an interface which can be replaced in tests. |
| 9 | type timer = interface { |
| 10 | C() <-chan time.Time |
| 11 | Reset(d time.Duration) bool |
| 12 | Stop() bool |
| 13 | } |
| 14 | |
| 15 | // timeTimer adapts a time.Timer to the timer interface. |
| 16 | type timeTimer struct { |
| 17 | *time.Timer |
| 18 | } |
| 19 | |
| 20 | func (t timeTimer) C() <-chan time.Time { return t.Timer.C } |