mirror of
https://github.com/btcsuite/btcd.git
synced 2024-11-19 01:40:07 +01:00
rpcclient: add http timeout
This commit is contained in:
parent
67b8efd3ba
commit
44c874f9f6
@ -92,6 +92,10 @@ const (
|
|||||||
// requestRetryInterval is the initial amount of time to wait in between
|
// requestRetryInterval is the initial amount of time to wait in between
|
||||||
// retries when sending HTTP POST requests.
|
// retries when sending HTTP POST requests.
|
||||||
requestRetryInterval = time.Millisecond * 500
|
requestRetryInterval = time.Millisecond * 500
|
||||||
|
|
||||||
|
// defaultHTTPTimeout is the default timeout for an http request, so the
|
||||||
|
// request does not block indefinitely.
|
||||||
|
defaultHTTPTimeout = time.Minute
|
||||||
)
|
)
|
||||||
|
|
||||||
// jsonRequest holds information about a json request that is used to properly
|
// jsonRequest holds information about a json request that is used to properly
|
||||||
@ -1363,6 +1367,7 @@ func newHTTPClient(config *ConnConfig) (*http.Client, error) {
|
|||||||
return net.Dial(parsedAddr.Network(), parsedAddr.String())
|
return net.Dial(parsedAddr.Network(), parsedAddr.String())
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Timeout: defaultHTTPTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &client, nil
|
return &client, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user