Skip to content

Commit

Permalink
p2p/enode: remove data race in sliceIter (#20421)
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusVanDerWijden authored and fjl committed Dec 5, 2019
1 parent e78f631 commit c9dce0b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions p2p/enode/iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func (it *sliceIter) Next() bool {
}

func (it *sliceIter) Node() *Node {
it.mu.Lock()
defer it.mu.Unlock()
if len(it.nodes) == 0 {
return nil
}
Expand Down

0 comments on commit c9dce0b

Please sign in to comment.