router/registry: fix concurrent map iteration and map write (#1762)
This commit is contained in:
parent
355ad2a1af
commit
dcf01ebbf0
@ -551,6 +551,10 @@ func (r *router) Advertise() (<-chan *Advert, error) {
|
|||||||
return nil, errors.New("not running")
|
return nil, errors.New("not running")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we're mutating the subscribers so they need to be locked also
|
||||||
|
r.sub.Lock()
|
||||||
|
defer r.sub.Unlock()
|
||||||
|
|
||||||
// already advertising
|
// already advertising
|
||||||
if r.eventChan != nil {
|
if r.eventChan != nil {
|
||||||
advertChan := make(chan *Advert, 128)
|
advertChan := make(chan *Advert, 128)
|
||||||
|
Loading…
Reference in New Issue
Block a user