Skip to content

Commit

Permalink
Merge pull request #104 from libp2p/fix/secio-hs-errs
Browse files Browse the repository at this point in the history
swarm: externalize secio handshake errors
  • Loading branch information
whyrusleeping authored Sep 6, 2016
2 parents 06db400 + 5758d3e commit b45c897
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 b45c897

Please sign in to comment.