Skip to content

Commit

Permalink
Merge pull request #11 from libp2p/fix/better-negotiation-errors
Browse files Browse the repository at this point in the history
annotate errors
  • Loading branch information
Stebalien authored Jan 10, 2019
2 parents 66b1a47 + 8ceb856 commit 5fc9b71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions p2p/net/upgrader/upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (u *Upgrader) upgrade(ctx context.Context, t transport.Transport, maconn ma
pconn, err := u.Protector.Protect(conn)
if err != nil {
conn.Close()
return nil, err
return nil, fmt.Errorf("failed to setup private network protector: %s", err)
}
conn = pconn
} else if pnet.ForcePrivateNetwork {
Expand All @@ -85,12 +85,12 @@ func (u *Upgrader) upgrade(ctx context.Context, t transport.Transport, maconn ma
sconn, err := u.setupSecurity(ctx, conn, p)
if err != nil {
conn.Close()
return nil, err
return nil, fmt.Errorf("failed to negotiate security protocol: %s", err)
}
smconn, err := u.setupMuxer(ctx, sconn, p)
if err != nil {
conn.Close()
return nil, err
return nil, fmt.Errorf("failed to negotiate security stream multiplexer: %s", err)
}
return &transportConn{
Conn: smconn,
Expand Down

0 comments on commit 5fc9b71

Please sign in to comment.