rippled
Loading...
Searching...
No Matches
src/xrpld/peerfinder/detail/Tuning.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_PEERFINDER_TUNING_H_INCLUDED
21#define RIPPLE_PEERFINDER_TUNING_H_INCLUDED
22
23#include <array>
24
25namespace ripple {
26namespace PeerFinder {
27
30namespace Tuning {
31
32enum {
33 //---------------------------------------------------------
34 //
35 // Automatic Connection Policy
36 //
37 //---------------------------------------------------------
38
41
43 ,
45
51 ,
52 outPercent = 15
53
58 ,
59 minOutCount = 10
60
62 ,
64
69 ,
70 maxRedirects = 30
71};
72
73//------------------------------------------------------------------------------
74//
75// Fixed
76//
77//------------------------------------------------------------------------------
78
80 {1, 1, 2, 3, 5, 8, 13, 21, 34, 55}};
81
82//------------------------------------------------------------------------------
83//
84// Bootcache
85//
86//------------------------------------------------------------------------------
87
88enum {
89 // Threshold of cache entries above which we trim.
90 bootcacheSize = 1000
91
92 // The percentage of addresses we prune when we trim the cache.
93 ,
95};
96
97// The cool down wait between database updates
98// Ideally this should be larger than the time it takes a full
99// peer to send us a set of addresses and then disconnect.
100//
102
103//------------------------------------------------------------------------------
104//
105// Livecache
106//
107//------------------------------------------------------------------------------
108
109// Drop incoming messages with hops greater than this number
110std::uint32_t constexpr maxHops = 6;
111
112// How many Endpoint to send in each mtENDPOINTS
114
115// The most Endpoint we will accept in mtENDPOINTS
117 std::max<decltype(numberOfEndpoints)>(numberOfEndpoints * 2, 64);
118
119// Number of addresses we provide when redirecting.
121
122// How often we send or accept mtENDPOINTS messages per peer
123// (we use a prime number of purpose)
125
126// How long an Endpoint will stay in the cache
127// This should be a small multiple of the broadcast frequency
129
130// How much time to wait before trying an outgoing address again.
131// Note that we ignore the port for purposes of comparison.
133
134} // namespace Tuning
137} // namespace PeerFinder
138} // namespace ripple
139
140#endif
std::chrono::seconds constexpr secondsPerMessage(151)
std::chrono::seconds constexpr recentAttemptDuration(60)
static std::chrono::seconds const bootcacheCooldownTime(60)
std::chrono::seconds constexpr liveCacheSecondsToLive(30)
static std::array< int, 10 > const connectionBackoff
@ secondsPerConnect
Time to wait between making batches of connection attempts.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:25