Commit 217da8e8 authored by Cole Brown's avatar Cole Brown

Return error when closing already closed emitter

parent b1629519
...@@ -38,7 +38,7 @@ func (e *emitter) Emit(evt interface{}) error { ...@@ -38,7 +38,7 @@ func (e *emitter) Emit(evt interface{}) error {
func (e *emitter) Close() error { func (e *emitter) Close() error {
if !atomic.CompareAndSwapInt32(&e.closed, 0, 1) { if !atomic.CompareAndSwapInt32(&e.closed, 0, 1) {
panic("closed an emitter more than once") return fmt.Errorf("closed an emitter more than once")
} }
if atomic.AddInt32(&e.n.nEmitters, -1) == 0 { if atomic.AddInt32(&e.n.nEmitters, -1) == 0 {
e.dropper(e.typ) e.dropper(e.typ)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment