rippled
Loading...
Searching...
No Matches
xrpld
peerfinder
detail
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
25
namespace
ripple
{
26
namespace
PeerFinder {
27
30
namespace
Tuning {
31
32
enum
{
33
//---------------------------------------------------------
34
//
35
// Automatic Connection Policy
36
//
37
//---------------------------------------------------------
38
40
secondsPerConnect
= 10
41
43
,
44
maxConnectAttempts
= 20
45
51
,
52
outPercent
= 15
53
58
,
59
minOutCount
= 10
60
62
,
63
defaultMaxPeers
= 21
64
69
,
70
maxRedirects
= 30
71
};
72
73
//------------------------------------------------------------------------------
74
//
75
// Fixed
76
//
77
//------------------------------------------------------------------------------
78
79
static
std::array<int, 10>
const
connectionBackoff
{
80
{1, 1, 2, 3, 5, 8, 13, 21, 34, 55}};
81
82
//------------------------------------------------------------------------------
83
//
84
// Bootcache
85
//
86
//------------------------------------------------------------------------------
87
88
enum
{
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
,
94
bootcachePrunePercent
= 10
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
//
101
static
std::chrono::seconds
const
bootcacheCooldownTime
(60);
102
103
//------------------------------------------------------------------------------
104
//
105
// Livecache
106
//
107
//------------------------------------------------------------------------------
108
109
// Drop incoming messages with hops greater than this number
110
std::uint32_t
constexpr
maxHops
= 6;
111
112
// How many Endpoint to send in each mtENDPOINTS
113
std::uint32_t
constexpr
numberOfEndpoints
= 2 *
maxHops
;
114
115
// The most Endpoint we will accept in mtENDPOINTS
116
std::uint32_t
constexpr
numberOfEndpointsMax
=
117
std::max<decltype(numberOfEndpoints)>
(
numberOfEndpoints
* 2, 64);
118
119
// Number of addresses we provide when redirecting.
120
std::uint32_t
constexpr
redirectEndpointCount
= 10;
121
122
// How often we send or accept mtENDPOINTS messages per peer
123
// (we use a prime number of purpose)
124
std::chrono::seconds
constexpr
secondsPerMessage
(151);
125
126
// How long an Endpoint will stay in the cache
127
// This should be a small multiple of the broadcast frequency
128
std::chrono::seconds
constexpr
liveCacheSecondsToLive
(30);
129
130
// How much time to wait before trying an outgoing address again.
131
// Note that we ignore the port for purposes of comparison.
132
std::chrono::seconds
constexpr
recentAttemptDuration
(60);
133
134
}
// namespace Tuning
137
}
// namespace PeerFinder
138
}
// namespace ripple
139
140
#endif
array
std::chrono::seconds
std::uint32_t
std::is_same_v
T is_same_v
ripple::PeerFinder::Tuning::secondsPerMessage
std::chrono::seconds constexpr secondsPerMessage(151)
ripple::PeerFinder::Tuning::redirectEndpointCount
std::uint32_t constexpr redirectEndpointCount
Definition
src/xrpld/peerfinder/detail/Tuning.h:120
ripple::PeerFinder::Tuning::numberOfEndpointsMax
std::uint32_t constexpr numberOfEndpointsMax
Definition
src/xrpld/peerfinder/detail/Tuning.h:116
ripple::PeerFinder::Tuning::numberOfEndpoints
std::uint32_t constexpr numberOfEndpoints
Definition
src/xrpld/peerfinder/detail/Tuning.h:113
ripple::PeerFinder::Tuning::recentAttemptDuration
std::chrono::seconds constexpr recentAttemptDuration(60)
ripple::PeerFinder::Tuning::bootcachePrunePercent
@ bootcachePrunePercent
Definition
src/xrpld/peerfinder/detail/Tuning.h:94
ripple::PeerFinder::Tuning::bootcacheSize
@ bootcacheSize
Definition
src/xrpld/peerfinder/detail/Tuning.h:90
ripple::PeerFinder::Tuning::bootcacheCooldownTime
static std::chrono::seconds const bootcacheCooldownTime(60)
ripple::PeerFinder::Tuning::liveCacheSecondsToLive
std::chrono::seconds constexpr liveCacheSecondsToLive(30)
ripple::PeerFinder::Tuning::connectionBackoff
static std::array< int, 10 > const connectionBackoff
Definition
src/xrpld/peerfinder/detail/Tuning.h:79
ripple::PeerFinder::Tuning::maxHops
std::uint32_t constexpr maxHops
Definition
src/xrpld/peerfinder/detail/Tuning.h:110
ripple::PeerFinder::Tuning::maxRedirects
@ maxRedirects
Definition
src/xrpld/peerfinder/detail/Tuning.h:70
ripple::PeerFinder::Tuning::outPercent
@ outPercent
Definition
src/xrpld/peerfinder/detail/Tuning.h:52
ripple::PeerFinder::Tuning::secondsPerConnect
@ secondsPerConnect
Time to wait between making batches of connection attempts.
Definition
src/xrpld/peerfinder/detail/Tuning.h:40
ripple::PeerFinder::Tuning::maxConnectAttempts
@ maxConnectAttempts
Definition
src/xrpld/peerfinder/detail/Tuning.h:44
ripple::PeerFinder::Tuning::minOutCount
@ minOutCount
Definition
src/xrpld/peerfinder/detail/Tuning.h:59
ripple::PeerFinder::Tuning::defaultMaxPeers
@ defaultMaxPeers
Definition
src/xrpld/peerfinder/detail/Tuning.h:63
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:25
Generated by
1.9.8