Commit cc4d2cbe authored by vikaschoudhary16's avatar vikaschoudhary16

Fix a race in the endpoint.go

parent 572e2764
...@@ -164,7 +164,11 @@ func (e *endpointImpl) run() { ...@@ -164,7 +164,11 @@ func (e *endpointImpl) run() {
} }
e.mutex.Lock() e.mutex.Lock()
e.devices = devices // NOTE: Return a copy of 'devices' instead of returning a direct reference to local 'devices'
e.devices = make(map[string]pluginapi.Device)
for _, d := range devices {
e.devices[d.ID] = d
}
e.mutex.Unlock() e.mutex.Unlock()
e.callback(e.resourceName, added, updated, deleted) e.callback(e.resourceName, added, updated, deleted)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment