Skip to content

Commit 582b999

Browse files
committed
rpcclient: ensure http dial respects timeout
Ensure that the dial phase of rpcclient's HTTP posts respects the http.Client's Timeout. It was instead falling back to the OS settings.
1 parent 442ef28 commit 582b999

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rpcclient/infrastructure.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,10 +1356,11 @@ func newHTTPClient(config *ConnConfig) (*http.Client, error) {
13561356
Transport: &http.Transport{
13571357
Proxy: proxyFunc,
13581358
TLSClientConfig: tlsConfig,
1359-
DialContext: func(_ context.Context, _,
1359+
DialContext: func(ctx context.Context, _,
13601360
_ string) (net.Conn, error) {
1361-
1362-
return net.Dial(
1361+
d := &net.Dialer{}
1362+
return d.DialContext(
1363+
ctx,
13631364
parsedDialAddr.Network(),
13641365
parsedDialAddr.String(),
13651366
)

0 commit comments

Comments
 (0)