p2p, p2p/enode: fix data races (#23434)

In p2p/dial.go, conn.flags was accessed without using sync/atomic.
This race is fixed by removing the access.

In p2p/enode/iter_test.go, a similar race is resolved by writing the field atomically.

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
Marius van der Wijden
2021-08-24 12:22:56 +02:00
committed by GitHub
parent 79bb9300c1
commit 8dbf261fd9
2 changed files with 4 additions and 4 deletions

View File

@ -268,7 +268,7 @@ func (s *genIter) Node() *Node {
}
func (s *genIter) Close() {
s.index = ^uint32(0)
atomic.StoreUint32(&s.index, ^uint32(0))
}
func testNode(id, seq uint64) *Node {