Fix send on closed channel bug

Signed-off-by: Chun Chen <chenchun.feed@gmail.com>
(cherry picked from commit a408790de8)
This commit is contained in:
Chun Chen
2015-06-12 15:42:34 +08:00
committed by Jessica Frazelle
parent 7ffbd7eaee
commit 84b21b55b9
+1
View File
@@ -68,6 +68,7 @@ func (p *Publisher) Publish(v interface{}) {
func (p *Publisher) Close() {
p.m.Lock()
for sub := range p.subscribers {
delete(p.subscribers, sub)
close(sub)
}
p.m.Unlock()