Skip to content

Commit

Permalink
p2p/simulations: LiveEvents DidConnect and DidDisconnect use GetOrCre…
Browse files Browse the repository at this point in the history
…ateConn
  • Loading branch information
Fabio Barone committed Apr 29, 2017
1 parent 3f21bec commit 7752650
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions p2p/simulations/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 7752650

Please sign in to comment.