mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-14 15:25:51 +02:00
init: do not count file descriptors for HTTPServer if -server=0
This commit is contained in:
@@ -1084,6 +1084,10 @@ bool AppInitParameterInteraction(const ArgsManager& args)
|
||||
if (user_rpc_max_connections < 1) {
|
||||
return InitError(Untranslated("-rpcmaxconnections must be greater than zero. Use -server=0 to disable HTTP."));
|
||||
}
|
||||
if (!args.GetBoolArg("-server", false)) {
|
||||
num_rpc_bind = 0;
|
||||
user_rpc_max_connections = 0;
|
||||
}
|
||||
|
||||
// Reserve enough FDs to account for the bare minimum, plus any manual connections, plus the bound interfaces.
|
||||
// Every element is an int >= 0 so summing in int64_t cannot overflow.
|
||||
|
||||
@@ -408,6 +408,16 @@ class InitTest(BitcoinTestFramework):
|
||||
match=ErrorMatch.PARTIAL_REGEX
|
||||
)
|
||||
|
||||
# Start without the HTTP server to ensure that -rpcmaxconnections is ignored
|
||||
with node.assert_debug_log(
|
||||
expected_msgs = ["net thread start"],
|
||||
unexpected_msgs = ["Initialized HTTP server"],
|
||||
timeout = 10
|
||||
):
|
||||
node.start(extra_args=[f"-rpcmaxconnections={2**64}", "-server=0"])
|
||||
# No HTTP server, no RPC `stop`
|
||||
node.kill_process()
|
||||
|
||||
def run_test(self):
|
||||
self.init_pid_test()
|
||||
self.init_stress_test_interrupt()
|
||||
|
||||
Reference in New Issue
Block a user