Skip to content

Commit

Permalink
swarm: externalize secio handshake errors
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Sep 5, 2016
1 parent 6856aa8 commit ef69b8b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/net/swarm/swarm_dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...
Expand Down

0 comments on commit ef69b8b

Please sign in to comment.