Patch for concurrent iterator & others (onto v1.11.6) #386

Closed
roysc wants to merge 1565 commits from v1.11.6-statediff-v5 into master
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 8dbf261fd9 - Show all commits

View File

@ -107,7 +107,7 @@ type dialScheduler struct {
// Everything below here belongs to loop and // Everything below here belongs to loop and
// should only be accessed by code on the loop goroutine. // should only be accessed by code on the loop goroutine.
dialing map[enode.ID]*dialTask // active tasks dialing map[enode.ID]*dialTask // active tasks
peers map[enode.ID]connFlag // all connected peers peers map[enode.ID]struct{} // all connected peers
dialPeers int // current number of dialed peers dialPeers int // current number of dialed peers
// The static map tracks all static dial tasks. The subset of usable static dial tasks // The static map tracks all static dial tasks. The subset of usable static dial tasks
@ -166,7 +166,7 @@ func newDialScheduler(config dialConfig, it enode.Iterator, setupFunc dialSetupF
setupFunc: setupFunc, setupFunc: setupFunc,
dialing: make(map[enode.ID]*dialTask), dialing: make(map[enode.ID]*dialTask),
static: make(map[enode.ID]*dialTask), static: make(map[enode.ID]*dialTask),
peers: make(map[enode.ID]connFlag), peers: make(map[enode.ID]struct{}),
doneCh: make(chan *dialTask), doneCh: make(chan *dialTask),
nodesIn: make(chan *enode.Node), nodesIn: make(chan *enode.Node),
addStaticCh: make(chan *enode.Node), addStaticCh: make(chan *enode.Node),
@ -259,7 +259,7 @@ loop:
d.dialPeers++ d.dialPeers++
} }
id := c.node.ID() id := c.node.ID()
d.peers[id] = c.flags d.peers[id] = struct{}{}
// Remove from static pool because the node is now connected. // Remove from static pool because the node is now connected.
task := d.static[id] task := d.static[id]
if task != nil && task.staticPoolIndex >= 0 { if task != nil && task.staticPoolIndex >= 0 {

View File

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