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 /swarm/network/simulation/connect.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 'swarm/network/simulation/connect.go')
-rw-r--r-- | swarm/network/simulation/connect.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/swarm/network/simulation/connect.go b/swarm/network/simulation/connect.go index 3d0f6cb3f..8b2aa1bfa 100644 --- a/swarm/network/simulation/connect.go +++ b/swarm/network/simulation/connect.go @@ -19,14 +19,14 @@ package simulation import ( "strings" - "github.com/ethereum/go-ethereum/p2p/discover" + "github.com/ethereum/go-ethereum/p2p/enode" ) // ConnectToPivotNode connects the node with provided NodeID // to the pivot node, already set by Simulation.SetPivotNode method. // It is useful when constructing a star network topology // when simulation adds and removes nodes dynamically. -func (s *Simulation) ConnectToPivotNode(id discover.NodeID) (err error) { +func (s *Simulation) ConnectToPivotNode(id enode.ID) (err error) { pid := s.PivotNodeID() if pid == nil { return ErrNoPivotNode @@ -38,7 +38,7 @@ func (s *Simulation) ConnectToPivotNode(id discover.NodeID) (err error) { // to the last node that is up, and avoiding connection to self. // It is useful when constructing a chain network topology // when simulation adds and removes nodes dynamically. -func (s *Simulation) ConnectToLastNode(id discover.NodeID) (err error) { +func (s *Simulation) ConnectToLastNode(id enode.ID) (err error) { ids := s.UpNodeIDs() l := len(ids) if l < 2 { @@ -53,7 +53,7 @@ func (s *Simulation) ConnectToLastNode(id discover.NodeID) (err error) { // ConnectToRandomNode connects the node with provieded NodeID // to a random node that is up. -func (s *Simulation) ConnectToRandomNode(id discover.NodeID) (err error) { +func (s *Simulation) ConnectToRandomNode(id enode.ID) (err error) { n := s.RandomUpNode(id) if n == nil { return ErrNodeNotFound @@ -64,7 +64,7 @@ func (s *Simulation) ConnectToRandomNode(id discover.NodeID) (err error) { // ConnectNodesFull connects all nodes one to another. // It provides a complete connectivity in the network // which should be rarely needed. -func (s *Simulation) ConnectNodesFull(ids []discover.NodeID) (err error) { +func (s *Simulation) ConnectNodesFull(ids []enode.ID) (err error) { if ids == nil { ids = s.UpNodeIDs() } @@ -82,7 +82,7 @@ func (s *Simulation) ConnectNodesFull(ids []discover.NodeID) (err error) { // ConnectNodesChain connects all nodes in a chain topology. // If ids argument is nil, all nodes that are up will be connected. -func (s *Simulation) ConnectNodesChain(ids []discover.NodeID) (err error) { +func (s *Simulation) ConnectNodesChain(ids []enode.ID) (err error) { if ids == nil { ids = s.UpNodeIDs() } @@ -98,7 +98,7 @@ func (s *Simulation) ConnectNodesChain(ids []discover.NodeID) (err error) { // ConnectNodesRing connects all nodes in a ring topology. // If ids argument is nil, all nodes that are up will be connected. -func (s *Simulation) ConnectNodesRing(ids []discover.NodeID) (err error) { +func (s *Simulation) ConnectNodesRing(ids []enode.ID) (err error) { if ids == nil { ids = s.UpNodeIDs() } @@ -118,7 +118,7 @@ func (s *Simulation) ConnectNodesRing(ids []discover.NodeID) (err error) { // ConnectNodesStar connects all nodes in a star topology // with the center at provided NodeID. // If ids argument is nil, all nodes that are up will be connected. -func (s *Simulation) ConnectNodesStar(id discover.NodeID, ids []discover.NodeID) (err error) { +func (s *Simulation) ConnectNodesStar(id enode.ID, ids []enode.ID) (err error) { if ids == nil { ids = s.UpNodeIDs() } @@ -138,7 +138,7 @@ func (s *Simulation) ConnectNodesStar(id discover.NodeID, ids []discover.NodeID) // ConnectNodesStarPivot connects all nodes in a star topology // with the center at already set pivot node. // If ids argument is nil, all nodes that are up will be connected. -func (s *Simulation) ConnectNodesStarPivot(ids []discover.NodeID) (err error) { +func (s *Simulation) ConnectNodesStarPivot(ids []enode.ID) (err error) { id := s.PivotNodeID() if id == nil { return ErrNoPivotNode @@ -147,7 +147,7 @@ func (s *Simulation) ConnectNodesStarPivot(ids []discover.NodeID) (err error) { } // connect connects two nodes but ignores already connected error. -func (s *Simulation) connect(oneID, otherID discover.NodeID) error { +func (s *Simulation) connect(oneID, otherID enode.ID) error { return ignoreAlreadyConnectedErr(s.Net.Connect(oneID, otherID)) } |