Skip to content

Commit

Permalink
check error before GotConn for trace
Browse files Browse the repository at this point in the history
Signed-off-by: Ye Sijun <junnplus@gmail.com>
  • Loading branch information
junnplus authored and garyburd committed Jul 12, 2022
1 parent bc7ce89 commit af47554
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client.go
Expand Up @@ -319,14 +319,14 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
}

netConn, err := netDial("tcp", hostPort)
if err != nil {
return nil, nil, err
}
if trace != nil && trace.GotConn != nil {
trace.GotConn(httptrace.GotConnInfo{
Conn: netConn,
})
}
if err != nil {
return nil, nil, err
}

defer func() {
if netConn != nil {
Expand Down

0 comments on commit af47554

Please sign in to comment.