diff options
author | Martin Zumsande <mzumsande@gmail.com> | 2023-02-14 17:40:14 -0500 |
---|---|---|
committer | Amiti Uttarwar <amiti@uttarwar.org> | 2023-08-03 19:27:23 -0600 |
commit | 1b52d16d07be3b5d968157913f04d9cd1e2d3678 (patch) | |
tree | ade1e95d9bc6fab93ca3e1506783bfcbb2e8bbcc /src/net.h | |
parent | 65cff00ceea48ac8a887ffea79aedb4251aa097f (diff) |
p2p: network-specific management of outbound connections
Diversify outbound connections with respect to
networks: Every ~5 minutes, try to add an extra connection
to a reachable network which we currently don't have a connection to.
This is done defensively - only try management with respect to networks
after all existing outbound slots are filled.
The resulting situation with an extra outbound peer will be handled
by the extra outbound eviction logic, which protects peers from
eviction if they are the only ones for their network.
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
Diffstat (limited to 'src/net.h')
-rw-r--r-- | src/net.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1031,6 +1031,18 @@ private: */ std::vector<CAddress> GetCurrentBlockRelayOnlyConns() const; + /** + * Search for a "preferred" network, a reachable network to which we + * currently don't have any OUTBOUND_FULL_RELAY or MANUAL connections. + * There needs to be at least one address in AddrMan for a preferred + * network to be picked. + * + * @param[out] network Preferred network, if found. + * + * @return bool Whether a preferred network was found. + */ + bool MaybePickPreferredNetwork(std::optional<Network>& network); + // Whether the node should be passed out in ForEach* callbacks static bool NodeFullyConnected(const CNode* pnode); |