Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p2p: fixed data races #23434

Merged
merged 2 commits into from Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion p2p/dial.go
Expand Up @@ -25,6 +25,7 @@ import (
mrand "math/rand"
"net"
"sync"
"sync/atomic"
"time"

"github.com/ethereum/go-ethereum/common/mclock"
Expand Down Expand Up @@ -259,7 +260,7 @@ loop:
d.dialPeers++
}
id := c.node.ID()
d.peers[id] = c.flags
d.peers[id] = connFlag(atomic.LoadInt32((*int32)(&c.flags)))
// Remove from static pool because the node is now connected.
task := d.static[id]
if task != nil && task.staticPoolIndex >= 0 {
Expand Down
2 changes: 1 addition & 1 deletion p2p/enode/iter_test.go
Expand Up @@ -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 {
Expand Down