|
@@ -66,8 +66,11 @@ func (p *Publisher) SubscribeTopicWithBuffer(topic topicFunc, buffer int) chan i
|
|
|
// Evict removes the specified subscriber from receiving any more messages.
|
|
|
func (p *Publisher) Evict(sub chan interface{}) {
|
|
|
p.m.Lock()
|
|
|
- delete(p.subscribers, sub)
|
|
|
- close(sub)
|
|
|
+ _, exists := p.subscribers[sub]
|
|
|
+ if exists {
|
|
|
+ delete(p.subscribers, sub)
|
|
|
+ close(sub)
|
|
|
+ }
|
|
|
p.m.Unlock()
|
|
|
}
|
|
|
|