diff --git a/common/throttle_timer.go b/common/throttle_timer.go index 4a4b30033..051d44376 100644 --- a/common/throttle_timer.go +++ b/common/throttle_timer.go @@ -52,8 +52,8 @@ func (t *ThrottleTimer) run() { select { case cmd := <-t.input: // stop goroutine if the input says so + // don't close channels, as closed channels mess up select reads if t.processInput(cmd) { - close(t.Ch) return } case <-t.timer.C: diff --git a/common/throttle_timer_test.go b/common/throttle_timer_test.go index f6b5d1df5..7d96ac7c5 100644 --- a/common/throttle_timer_test.go +++ b/common/throttle_timer_test.go @@ -31,6 +31,9 @@ func (c *thCounter) Count() int { // Read should run in a go-routine and // updates count by one every time a packet comes in func (c *thCounter) Read() { + // note, since this channel never closes, this will never end + // if thCounter was used in anything beyond trivial test cases. + // it would have to be smarter. for range c.input { c.Increment() }