mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p/enode prevent data race in sliceIter
Node() had a data race with Next()
This commit is contained in:
parent
7ce7c3967c
commit
7d12adc7b9
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue