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 {
|
select {
|
||||||
case <-r.exit:
|
case <-r.exit:
|
||||||
close(r.eventChan)
|
|
||||||
return nil
|
return nil
|
||||||
case r.eventChan <- event:
|
case r.eventChan <- event:
|
||||||
// process event
|
// process event
|
||||||
@ -705,10 +704,13 @@ func (r *router) Close() error {
|
|||||||
r.sub.Unlock()
|
r.sub.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove event chan
|
// close and remove event chan
|
||||||
|
if r.eventChan != nil {
|
||||||
|
close(r.eventChan)
|
||||||
r.eventChan = nil
|
r.eventChan = nil
|
||||||
r.running = false
|
}
|
||||||
|
|
||||||
|
r.running = false
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user