Fix send on closed channel bug
Signed-off-by: Chun Chen <chenchun.feed@gmail.com>
This commit is contained in:
parent
e10c7b3f07
commit
33cd97fb23
1 changed files with 1 additions and 0 deletions
|
@ -68,6 +68,7 @@ func (p *Publisher) Publish(v interface{}) {
|
||||||
func (p *Publisher) Close() {
|
func (p *Publisher) Close() {
|
||||||
p.m.Lock()
|
p.m.Lock()
|
||||||
for sub := range p.subscribers {
|
for sub := range p.subscribers {
|
||||||
|
delete(p.subscribers, sub)
|
||||||
close(sub)
|
close(sub)
|
||||||
}
|
}
|
||||||
p.m.Unlock()
|
p.m.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue