diff options
author | Amiti Uttarwar <amiti@uttarwar.org> | 2023-08-31 13:41:30 -0700 |
---|---|---|
committer | Martin Zumsande <mzumsande@gmail.com> | 2023-10-03 13:52:47 -0400 |
commit | e9fd9c0225527ec7727d2a7ccbdf028784aadc6c (patch) | |
tree | 7259d80bc5389a3d39f32ea668257f18a0a2717c /src/net.h | |
parent | c25e0e05550426f29d79571368d90f63fb472b02 (diff) |
net: add m_max_inbound to connman
Extract the logic for calculating & maintaining inbound connection limits to be
a member within connman for consistency with other maximum connection limits.
Note that we now limit m_max_inbound to 0 and don't call
AttemptToEvictConnection() when we don't have any inbounds.
Previously, nMaxInbound could become negative if the user ran with a low
-maxconnections, which didn't break any logic but didn't make sense.
Co-authored-by: Martin Zumsande <mzumsande@gmail.com>
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1088,6 +1088,7 @@ public: m_max_outbound_full_relay = std::min(MAX_OUTBOUND_FULL_RELAY_CONNECTIONS, nMaxConnections); m_max_outbound_block_relay = std::min(MAX_BLOCK_RELAY_ONLY_CONNECTIONS, nMaxConnections - m_max_outbound_full_relay); m_max_outbound = m_max_outbound_full_relay + m_max_outbound_block_relay + nMaxFeeler; + m_max_inbound = std::max(0, nMaxConnections - m_max_outbound); m_use_addrman_outgoing = connOptions.m_use_addrman_outgoing; m_client_interface = connOptions.uiInterface; m_banman = connOptions.m_banman; @@ -1485,6 +1486,7 @@ private: int nMaxAddnode{MAX_ADDNODE_CONNECTIONS}; int nMaxFeeler{MAX_FEELER_CONNECTIONS}; int m_max_outbound; + int m_max_inbound; bool m_use_addrman_outgoing; CClientUIInterface* m_client_interface; NetEventsInterface* m_msgproc; |