Lock agent access in addDriverWatches
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
f34bd07737
commit
8653b72786
1 changed files with 5 additions and 1 deletions
|
@ -468,8 +468,12 @@ func (n *network) addDriverWatches() {
|
|||
|
||||
c := n.getController()
|
||||
for _, tableName := range n.driverTables {
|
||||
ch, cancel := c.agent.networkDB.Watch(tableName, n.ID(), "")
|
||||
c.Lock()
|
||||
if c.agent == nil {
|
||||
c.Unlock()
|
||||
return
|
||||
}
|
||||
ch, cancel := c.agent.networkDB.Watch(tableName, n.ID(), "")
|
||||
c.agent.driverCancelFuncs[n.ID()] = append(c.agent.driverCancelFuncs[n.ID()], cancel)
|
||||
c.Unlock()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue