mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-22 07:49:26 +00:00
rpc: close ws handshake response body on error
This commit is contained in:
parent
b80ffe98a5
commit
70a52dc4fb
1 changed files with 3 additions and 0 deletions
|
|
@ -249,6 +249,9 @@ func newClientTransportWS(endpoint string, cfg *clientConfig) (reconnectFunc, er
|
||||||
}
|
}
|
||||||
conn, resp, err := dialer.DialContext(ctx, dialURL, header)
|
conn, resp, err := dialer.DialContext(ctx, dialURL, header)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if resp != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
}
|
||||||
hErr := wsHandshakeError{err: err}
|
hErr := wsHandshakeError{err: err}
|
||||||
if resp != nil {
|
if resp != nil {
|
||||||
hErr.status = resp.Status
|
hErr.status = resp.Status
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue