diff options
author | Janos Guljas <janos@resenje.org> | 2018-09-25 22:57:31 +0800 |
---|---|---|
committer | Janos Guljas <janos@resenje.org> | 2018-09-25 22:57:31 +0800 |
commit | 24349144b6c0642755569268bab56b9033743212 (patch) | |
tree | 9d9d2b6659fd8a56512dfc807aafe4b733165ae1 /p2p/testing/peerpool.go | |
parent | 7d56602391e155e2ce9ba7c261300a1804ab9972 (diff) | |
parent | d3441ebb563439bac0837d70591f92e2c6080303 (diff) | |
download | dexon-24349144b6c0642755569268bab56b9033743212.tar dexon-24349144b6c0642755569268bab56b9033743212.tar.gz dexon-24349144b6c0642755569268bab56b9033743212.tar.bz2 dexon-24349144b6c0642755569268bab56b9033743212.tar.lz dexon-24349144b6c0642755569268bab56b9033743212.tar.xz dexon-24349144b6c0642755569268bab56b9033743212.tar.zst dexon-24349144b6c0642755569268bab56b9033743212.zip |
Merge branch 'master' into max-stream-peer-servers
Diffstat (limited to 'p2p/testing/peerpool.go')
-rw-r--r-- | p2p/testing/peerpool.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/p2p/testing/peerpool.go b/p2p/testing/peerpool.go index ed00396e2..01ccce67e 100644 --- a/p2p/testing/peerpool.go +++ b/p2p/testing/peerpool.go @@ -21,22 +21,22 @@ import ( "sync" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/p2p/enode" ) type TestPeer interface { - ID() discover.NodeID + ID() enode.ID Drop(error) } // TestPeerPool is an example peerPool to demonstrate registration of peer connections type TestPeerPool struct { lock sync.Mutex - peers map[discover.NodeID]TestPeer + peers map[enode.ID]TestPeer } func NewTestPeerPool() *TestPeerPool { - return &TestPeerPool{peers: make(map[discover.NodeID]TestPeer)} + return &TestPeerPool{peers: make(map[enode.ID]TestPeer)} } func (p *TestPeerPool) Add(peer TestPeer) { @@ -53,14 +53,14 @@ func (p *TestPeerPool) Remove(peer TestPeer) { delete(p.peers, peer.ID()) } -func (p *TestPeerPool) Has(id discover.NodeID) bool { +func (p *TestPeerPool) Has(id enode.ID) bool { p.lock.Lock() defer p.lock.Unlock() _, ok := p.peers[id] return ok } -func (p *TestPeerPool) Get(id discover.NodeID) TestPeer { +func (p *TestPeerPool) Get(id enode.ID) TestPeer { p.lock.Lock() defer p.lock.Unlock() return p.peers[id] |