Commit message · merge-scriptMerge bitcoin/bitcoin#36453: util, cli: name the Sock wait timeout cap and use it for -rpcclienttimeout=0
d22d3565128828e158c6684a1b5bf1a7f2454c80 util, cli: name the Sock wait timeout cap and use it for -rpcclienttimeout=0 (Kanan)
Pull request description:
Follow-up to #36340, addressing the review comments from pinheadmz and winterrdog there.
#36340 capped the `Sock::Wait`/`WaitMany` timeout at `INT_MAX` milliseconds (about 24.8 days) inside `WaitMany`. This moves that value to a named constant, `Sock::MAX_WAIT_TIMEOUT`, and mentions the cap in the doxygen comments of `Wait()` and `WaitMany()`, since it applies to every caller and not only to `bitcoin-cli`. The constant is a whole number of seconds (2147483 s), so `bitcoin-cli`, which works in seconds, uses exactly the same value as `Sock`.
`bitcoin-cli` still turned `-rpcclienttimeout=0` into a 5 year timeout. The timeout is applied to each wait for the socket, and each wait is now capped, so in practice `0` already means "give up after about 24.8 days without data". The 5 year value is replaced with `Sock::MAX_WAIT_TIMEOUT`, and the help text now says that 0 is the longest supported timeout (about 24 days) instead of no timeout.
There is no behaviour change. `sock_tests`, `interface_bitcoin_cli.py` (including the `-rpcclienttimeout=0` call added in #36340) and `interface_rpc.py` pass on macOS.
(Changes prepared with AI tools.)
ACKs for top commit:
winterrdog:
reACK d22d3565128828e158c6684a1b5bf1a7f2454c80
pinheadmz:
ACK d22d3565128828e158c6684a1b5bf1a7f2454c80
sedited:
ACK d22d3565128828e158c6684a1b5bf1a7f2454c80
Tree-SHA512: 03d6e3b0587fddcdaadcf2d8b997ccd0b92db62abeeafc02895739a1984dbf4231b854b3b430d84d3bca4970020f043c9ea8b32bc1022d372440e36d0d5b1ad7
81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queuedmerge-commit duplicate discount