xrpld
Loading...
Searching...
No Matches
Fixed.h
1#pragma once
2
3#include <xrpld/peerfinder/detail/Tuning.h>
4
5namespace xrpl::PeerFinder {
6
8class Fixed
9{
10public:
11 explicit Fixed(clock_type& clock) : when_(clock.now())
12 {
13 }
14
15 Fixed(Fixed const&) = default;
16
18 [[nodiscard]] clock_type::time_point const&
19 when() const
20 {
21 return when_;
22 }
23
25 void
31
33 void
35 {
36 failures_ = 0;
37 when_ = now;
38 }
39
40private:
43};
44
45} // namespace xrpl::PeerFinder
std::chrono::steady_clock::time_point time_point
clock_type::time_point const & when() const
Returns the time after which we should allow a connection attempt.
Definition Fixed.h:19
clock_type::time_point when_
Definition Fixed.h:41
void failure(clock_type::time_point const &now)
Updates metadata to reflect a failed connection.
Definition Fixed.h:26
Fixed(clock_type &clock)
Definition Fixed.h:11
std::size_t failures_
Definition Fixed.h:42
void success(clock_type::time_point const &now)
Updates metadata to reflect a successful connection.
Definition Fixed.h:34
Fixed(Fixed const &)=default
T min(T... args)
static std::array< int, 10 > const kConnectionBackoff
beast::AbstractClock< std::chrono::steady_clock > clock_type