aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/simulations/network.go
diff options
context:
space:
mode:
Diffstat (limited to 'p2p/simulations/network.go')
-rw-r--r--p2p/simulations/network.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go
index fd8777673..f3dda2e44 100644
--- a/p2p/simulations/network.go
+++ b/p2p/simulations/network.go
@@ -403,9 +403,8 @@ func (self *Network) getNodeByName(name string) *Node {
func (self *Network) GetNodes() (nodes []*Node) {
self.lock.Lock()
defer self.lock.Unlock()
- for _, node := range self.Nodes {
- nodes = append(nodes, node)
- }
+
+ nodes = append(nodes, self.Nodes...)
return nodes
}
@@ -477,7 +476,7 @@ func (self *Network) InitConn(oneID, otherID discover.NodeID) (*Conn, error) {
if err != nil {
return nil, err
}
- if time.Now().Sub(conn.initiated) < dialBanTimeout {
+ if time.Since(conn.initiated) < dialBanTimeout {
return nil, fmt.Errorf("connection between %v and %v recently attempted", oneID, otherID)
}
if conn.Up {