fix GetAll() potentially return an unprotected map
This commit is contained in:
parent
e9e6b61c8e
commit
8c4a6e7e6f
@ -264,9 +264,13 @@ func (l *memoryStore) Get(name string) []string {
|
||||
|
||||
// Get returns all the registered service information
|
||||
func (l *memoryStore) GetAll() map[string][]string {
|
||||
res := make(map[string][]string)
|
||||
l.mu.RLock()
|
||||
defer l.mu.RUnlock()
|
||||
return l.servicesMap
|
||||
for k,v := range l.servicesMap {
|
||||
res[k] = append(make([]string,0,len(v)), v...)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// Init cleanup all the registered service information
|
||||
|
Loading…
Reference in New Issue
Block a user