router/registry: fix nil eventChan bug (#1773)
* router/registry: fix nil eventChan bug
This commit is contained in:
parent
1b5c83f3cc
commit
64e9185386
@ -285,7 +285,6 @@ func (r *router) watchTable(w Watcher) error {
|
||||
|
||||
select {
|
||||
case <-r.exit:
|
||||
close(r.eventChan)
|
||||
return nil
|
||||
case r.eventChan <- event:
|
||||
// process event
|
||||
@ -705,10 +704,13 @@ func (r *router) Close() error {
|
||||
r.sub.Unlock()
|
||||
}
|
||||
|
||||
// remove event chan
|
||||
r.eventChan = nil
|
||||
r.running = false
|
||||
// close and remove event chan
|
||||
if r.eventChan != nil {
|
||||
close(r.eventChan)
|
||||
r.eventChan = nil
|
||||
}
|
||||
|
||||
r.running = false
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user