mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
networkdb: Use write lock in handleNodeEvent
`handleNodeEvent` is calling `changeNodeState` which writes to various maps on the ndb object. Using a write lock prevents a panic on concurrent read/write access on these maps. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
e8802d9117
commit
bc465326fe
1 changed files with 2 additions and 2 deletions
|
@ -21,8 +21,8 @@ func (nDB *NetworkDB) handleNodeEvent(nEvent *NodeEvent) bool {
|
|||
// time.
|
||||
nDB.networkClock.Witness(nEvent.LTime)
|
||||
|
||||
nDB.RLock()
|
||||
defer nDB.RUnlock()
|
||||
nDB.Lock()
|
||||
defer nDB.Unlock()
|
||||
|
||||
// check if the node exists
|
||||
n, _, _ := nDB.findNode(nEvent.NodeName)
|
||||
|
|
Loading…
Add table
Reference in a new issue