Skip to content

Commit 5bba3aa

Browse files
committed
Lock agent access in addDriverWatches
Signed-off-by: Alessandro Boch <aboch@docker.com>
1 parent d271945 commit 5bba3aa

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

agent.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,12 @@ func (n *network) addDriverWatches() {
468468

469469
c := n.getController()
470470
for _, tableName := range n.driverTables {
471-
ch, cancel := c.agent.networkDB.Watch(tableName, n.ID(), "")
472471
c.Lock()
472+
if c.agent == nil {
473+
c.Unlock()
474+
return
475+
}
476+
ch, cancel := c.agent.networkDB.Watch(tableName, n.ID(), "")
473477
c.agent.driverCancelFuncs[n.ID()] = append(c.agent.driverCancelFuncs[n.ID()], cancel)
474478
c.Unlock()
475479

0 commit comments

Comments
 (0)