1#include <xrpl/peerfinder/detail/SlotImp.h>
3#include <xrpl/beast/net/IPEndpoint.h>
4#include <xrpl/beast/utility/instrumentation.h>
5#include <xrpl/peerfinder/Slot.h>
6#include <xrpl/peerfinder/Types.h>
7#include <xrpl/peerfinder/detail/Tuning.h>
52 state !=
State::Active,
"xrpl::peer_finder::SlotImp::state : input state is not active");
57 "xrpl::peer_finder::SlotImp::state : input state is different from "
63 "xrpl::peer_finder::SlotImp::state : input state is not an initial");
68 "xrpl::peer_finder::SlotImp::state : input state is not connected an "
74 "xrpl::peer_finder::SlotImp::state : input state is not closing an "
86 "xrpl::peer_finder::SlotImp::activate : valid state");
105 auto const result(
cache_.emplace(ep, hops));
109 if (hops <= result.first->second)
111 result.first->second = hops;
112 cache_.touch(result.first);
120 auto const iter(
cache_.find(ep));
126 return iter->second <= hops;
std::chrono::steady_clock::time_point time_point
A version-independent IP address and port combination.
RecentT(clock_type &clock)
bool filter(beast::ip::Endpoint const &ep, std::uint32_t hops)
Returns true if we should not send endpoint to the slot.
void insert(beast::ip::Endpoint const &ep, std::uint32_t hops)
Called for each valid endpoint received for a slot.
beast::aged_unordered_map< beast::ip::Endpoint, std::uint32_t > cache_
std::atomic< std::int32_t > listeningPort_
bool connectivityCheckInProgress
class xrpl::peer_finder::SlotImp::RecentT recent
std::optional< beast::ip::Endpoint > const & localEndpoint() const override
The local endpoint of the socket, when known.
State state() const override
Returns the state of the connection.
beast::ip::Endpoint const & remoteEndpoint() const override
The remote endpoint of socket.
clock_type::time_point whenAcceptEndpoints
SlotImp(beast::ip::Endpoint const &localEndpoint, beast::ip::Endpoint remoteEndpoint, bool fixed, clock_type &clock)
void activate(clock_type::time_point const &now)
std::optional< beast::ip::Endpoint > localEndpoint_
bool fixed() const override
Returns true if this is a fixed connection.
static std::int32_t constexpr kUnknownPort
beast::ip::Endpoint remoteEndpoint_
std::size_t expire(AgedContainer &c, std::chrono::duration< Rep, Period > const &age)
Expire aged container items past the specified age.
constexpr std::chrono::seconds kLiveCacheSecondsToLive(30)
beast::AbstractClock< std::chrono::steady_clock > clock_type