From e47722ecb2999baaf7a77131a421b8a3788a2267 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Mon, 19 Dec 2016 18:24:51 -0500 Subject: [PATCH] Connect2Switches: panic on err --- switch.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/switch.go b/switch.go index f39ed092..7fabe21a 100644 --- a/switch.go +++ b/switch.go @@ -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