forked from mirror/websocket
check error before GotConn for trace
Signed-off-by: Ye Sijun <junnplus@gmail.com>
This commit is contained in:
parent
bc7ce893c3
commit
af47554f34
|
@ -319,14 +319,14 @@ func (d *Dialer) DialContext(ctx context.Context, urlStr string, requestHeader h
|
||||||
}
|
}
|
||||||
|
|
||||||
netConn, err := netDial("tcp", hostPort)
|
netConn, err := netDial("tcp", hostPort)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
if trace != nil && trace.GotConn != nil {
|
if trace != nil && trace.GotConn != nil {
|
||||||
trace.GotConn(httptrace.GotConnInfo{
|
trace.GotConn(httptrace.GotConnInfo{
|
||||||
Conn: netConn,
|
Conn: netConn,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return nil, nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if netConn != nil {
|
if netConn != nil {
|
||||||
|
|
Loading…
Reference in New Issue