Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Commit

Permalink
Connect2Switches: panic on err
Browse files Browse the repository at this point in the history
  • Loading branch information
ebuchman committed Jan 13, 2017
1 parent 2b750ea commit e47722e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,17 @@ func Connect2Switches(switches []*Switch, i, j int) {
c1, c2 := net.Pipe()
doneCh := make(chan struct{})
go func() {
switchI.AddPeerWithConnection(c1, false) // AddPeer is blocking, requires handshake.
_, err := switchI.AddPeerWithConnection(c1, false) // AddPeer is blocking, requires handshake.
if err != nil {
panic(err)
}
doneCh <- struct{}{}
}()
go func() {
switchJ.AddPeerWithConnection(c2, true)
_, err := switchJ.AddPeerWithConnection(c2, true)
if err != nil {
panic(err)
}
doneCh <- struct{}{}
}()
<-doneCh
Expand Down

0 comments on commit e47722e

Please sign in to comment.