xrpld
Loading...
Searching...
No Matches
Fixed.h
1#pragma once
2
3#include <xrpl/peerfinder/Types.h>
4#include <xrpl/peerfinder/detail/Tuning.h>
5
6#include <algorithm>
7#include <chrono>
8#include <cstddef>
9
10namespace xrpl::peer_finder {
11
15class Fixed
16{
17public:
18 explicit Fixed(clock_type& clock) : when_(clock.now())
19 {
20 }
21
22 Fixed(Fixed const&) = default;
23
27 [[nodiscard]] clock_type::time_point const&
28 when() const
29 {
30 return when_;
31 }
32
36 void
42
46 void
48 {
49 failures_ = 0;
50 when_ = now;
51 }
52
53private:
56};
57
58} // namespace xrpl::peer_finder
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:28
std::size_t failures_
Definition Fixed.h:55
void failure(clock_type::time_point const &now)
Updates metadata to reflect a failed connection.
Definition Fixed.h:37
Fixed(Fixed const &)=default
clock_type::time_point when_
Definition Fixed.h:54
void success(clock_type::time_point const &now)
Updates metadata to reflect a successful connection.
Definition Fixed.h:47
Fixed(clock_type &clock)
Definition Fixed.h:18
T min(T... args)
static std::array< int, 10 > const kConnectionBackoff
beast::AbstractClock< std::chrono::steady_clock > clock_type