p2p/enode: remove data race in sliceIter (#20421)

This commit is contained in:
Marius van der Wijden 2019-12-05 22:16:35 +01:00 committed by Felix Lange
parent e78f631dfc
commit c9dce0bfd7

View File

@ -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
}