From a4b52df32c75f658b5956e7258380668b4a6f8ae Mon Sep 17 00:00:00 2001 From: Fabio Barone Date: Sat, 29 Apr 2017 09:40:23 -0500 Subject: [PATCH] p2p/simulations: LiveEvents DidConnect and DidDisconnect use GetOrCreateConn --- p2p/simulations/network.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/p2p/simulations/network.go b/p2p/simulations/network.go index 166e2b8282..5e2bba1079 100644 --- a/p2p/simulations/network.go +++ b/p2p/simulations/network.go @@ -700,8 +700,8 @@ func (self *Network) Disconnect(oneId, otherId *adapters.NodeId) error { } func (self *Network) DidConnect(one, other *adapters.NodeId) error { - conn := self.GetConn(one, other) - if conn == nil { + conn, err := self.GetOrCreateConn(one, other) + if err != nil { return fmt.Errorf("connection between %v and %v does not exist", one, other) } if conn.Up { @@ -715,8 +715,8 @@ func (self *Network) DidConnect(one, other *adapters.NodeId) error { } func (self *Network) DidDisconnect(one, other *adapters.NodeId) error { - conn := self.GetConn(one, other) - if conn == nil { + conn, err := self.GetOrCreateConn(one, other) + if err != nil { return fmt.Errorf("connection between %v and %v does not exist", one, other) } if !conn.Up {