xrpld
Loading...
Searching...
No Matches
src/xrpld/peerfinder/detail/Tuning.h
1#pragma once
2
3#include <array>
4
8
9//---------------------------------------------------------
10//
11// Automatic Connection Policy
12//
13//---------------------------------------------------------
14
16static constexpr auto kSecondsPerConnect = 10;
17
19static constexpr auto kMaxConnectAttempts = 20;
20
26static constexpr auto kOutPercent = 15;
27
32static constexpr auto kMinOutCount = 10;
33
35static constexpr auto kDefaultMaxPeers = 21;
36
41static constexpr auto kMaxRedirects = 30;
42
43//------------------------------------------------------------------------------
44//
45// Fixed
46//
47//------------------------------------------------------------------------------
48
49static std::array<int, 10> const kConnectionBackoff{{1, 1, 2, 3, 5, 8, 13, 21, 34, 55}};
50
51//------------------------------------------------------------------------------
52//
53// Bootcache
54//
55//------------------------------------------------------------------------------
56
57// Threshold of cache entries above which we trim.
58static constexpr auto kBootcacheSize = 1000;
59
60// The percentage of addresses we prune when we trim the cache.
61static constexpr auto kBootcachePrunePercent = 10;
62
63// The cool down wait between database updates
64// Ideally this should be larger than the time it takes a full
65// peer to send us a set of addresses and then disconnect.
66//
68
69//------------------------------------------------------------------------------
70//
71// Livecache
72//
73//------------------------------------------------------------------------------
74
75// Drop incoming messages with hops greater than this number
76constexpr std::uint32_t kMaxHops = 6;
77
78// How many Endpoint to send in each mtENDPOINTS
80
81// The most Endpoint we will accept in mtENDPOINTS
84
85// Number of addresses we provide when redirecting.
87
88// How often we send or accept mtENDPOINTS messages per peer
89// (we use a prime number of purpose)
91
92// How long an Endpoint will stay in the cache
93// This should be a small multiple of the broadcast frequency
95
96// How much time to wait before trying an outgoing address again.
97// Note that we ignore the port for purposes of comparison.
99
100} // namespace xrpl::PeerFinder::Tuning
101
T max(T... args)
static constexpr auto kMaxConnectAttempts
Maximum number of simultaneous connection attempts.
static constexpr auto kMaxRedirects
Max redirects we will accept from one connection.
static constexpr auto kSecondsPerConnect
Time to wait between making batches of connection attempts.
static std::array< int, 10 > const kConnectionBackoff
constexpr std::chrono::seconds kLiveCacheSecondsToLive(30)
static std::chrono::seconds const kBootcacheCooldownTime(60)
static constexpr auto kDefaultMaxPeers
The default value of Config::maxPeers.
constexpr std::chrono::seconds kRecentAttemptDuration(60)
static constexpr auto kMinOutCount
A hard minimum on the number of outgoing connections.
static constexpr auto kOutPercent
The percentage of total peer slots that are outbound.
constexpr std::chrono::seconds kSecondsPerMessage(151)