From 5758d3e652c442d45314161373219e962585dbe9 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 5 Sep 2016 14:48:28 -0700 Subject: [PATCH] swarm: externalize secio handshake errors --- p2p/net/swarm/swarm_dial.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2p/net/swarm/swarm_dial.go b/p2p/net/swarm/swarm_dial.go index 6774721247..6f82204347 100644 --- a/p2p/net/swarm/swarm_dial.go +++ b/p2p/net/swarm/swarm_dial.go @@ -450,7 +450,8 @@ func (s *Swarm) dialAddr(ctx context.Context, p peer.ID, addr ma.Multiaddr) (con remotep := connC.RemotePeer() if remotep != p { connC.Close() - return nil, fmt.Errorf("misdial to %s through %s (got %s)", p, addr, remotep) + _, err := connC.Read(nil) // should return any potential errors (ex: from secio) + return nil, fmt.Errorf("misdial to %s through %s (got %s): %s", p, addr, remotep, err) } // if the connection is to ourselves...