mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 14:13:52 +02:00
http: configure simultaneous connection limit with -rpcmaxconnections
This commit is contained in:
@@ -44,7 +44,7 @@ inline constexpr int DEFAULT_HTTP_SERVER_TIMEOUT=30;
|
||||
/**
|
||||
* Maximum number of connected HTTP clients
|
||||
*/
|
||||
inline constexpr int MAX_HTTP_CONNECTIONS = 16;
|
||||
inline constexpr int DEFAULT_MAX_HTTP_CONNECTIONS = 16;
|
||||
|
||||
enum class HTTPRequestMethod {
|
||||
UNKNOWN,
|
||||
@@ -316,6 +316,11 @@ public:
|
||||
*/
|
||||
void SetServerTimeout(std::chrono::seconds seconds) { m_rpcservertimeout = seconds; }
|
||||
|
||||
/**
|
||||
* Set the maximum amount of connected HTTPClients (-rpcmaxconnections)
|
||||
*/
|
||||
void SetMaxConnections(int max_conn) { m_rpcmaxconnections = max_conn; }
|
||||
|
||||
/**
|
||||
* Force-remove all remaining clients from m_connected without waiting for
|
||||
* graceful disconnection. Must only be called after JoinSocketsThreads().
|
||||
@@ -421,6 +426,11 @@ private:
|
||||
*/
|
||||
bool ClientAllowed(const CNetAddr& netaddr) const;
|
||||
|
||||
/**
|
||||
* Maximum amount of concurrent connections
|
||||
*/
|
||||
int m_rpcmaxconnections{DEFAULT_MAX_HTTP_CONNECTIONS};
|
||||
|
||||
/**
|
||||
* Accept a connection.
|
||||
* @param[in] listen_sock Socket on which to accept the connection.
|
||||
|
||||
Reference in New Issue
Block a user