xrpld
Loading...
Searching...
No Matches
xrpl::peer_finder::SlotImp Class Reference

#include <SlotImp.h>

Inheritance diagram for xrpl::peer_finder::SlotImp:
Collaboration diagram for xrpl::peer_finder::SlotImp:

Classes

class  RecentT

Public Types

using ptr = std::shared_ptr<SlotImp>
enum class  State {
  Accept , Connect , Connected , Active ,
  Closing
}

Public Member Functions

 SlotImp (beast::ip::Endpoint const &localEndpoint, beast::ip::Endpoint remoteEndpoint, bool fixed, clock_type &clock)
 SlotImp (beast::ip::Endpoint remoteEndpoint, bool fixed, clock_type &clock)
bool inbound () const override
 Returns true if this is an inbound connection.
bool fixed () const override
 Returns true if this is a fixed connection.
bool reserved () const override
 Returns true if this is a reserved connection.
State state () const override
 Returns the state of the connection.
beast::ip::Endpoint const & remoteEndpoint () const override
 The remote endpoint of socket.
std::optional< beast::ip::Endpoint > const & localEndpoint () const override
 The local endpoint of the socket, when known.
std::optional< PublicKey > const & publicKey () const override
 The peer's public key, when known.
std::string prefix () const
std::optional< std::uint16_tlisteningPort () const override
void setListeningPort (std::uint16_t port)
void localEndpoint (beast::ip::Endpoint const &endpoint)
void remoteEndpoint (beast::ip::Endpoint const &endpoint)
void publicKey (PublicKey const &key)
void reserved (bool reserved)
void state (State state)
void activate (clock_type::time_point const &now)
void expire ()

Public Attributes

class xrpl::peer_finder::SlotImp::RecentT recent
bool checked
bool canAccept
bool connectivityCheckInProgress
clock_type::time_point whenAcceptEndpoints

Private Attributes

bool const inbound_
bool const fixed_
bool reserved_
State state_
beast::ip::Endpoint remoteEndpoint_
std::optional< beast::ip::EndpointlocalEndpoint_
std::optional< PublicKeypublicKey_
std::atomic< std::int32_tlisteningPort_

Static Private Attributes

static std::int32_t constexpr kUnknownPort = -1

Detailed Description

Definition at line 17 of file SlotImp.h.

Member Typedef Documentation

◆ ptr

Definition at line 20 of file SlotImp.h.

Member Enumeration Documentation

◆ State

enum class xrpl::peer_finder::Slot::State
stronginherited
Enumerator
Accept 
Connect 
Connected 
Active 
Closing 

Definition at line 20 of file include/xrpl/peerfinder/Slot.h.

Constructor & Destructor Documentation

◆ SlotImp() [1/2]

xrpl::peer_finder::SlotImp::SlotImp ( beast::ip::Endpoint const & localEndpoint,
beast::ip::Endpoint remoteEndpoint,
bool fixed,
clock_type & clock )

Definition at line 14 of file SlotImp.cpp.

◆ SlotImp() [2/2]

xrpl::peer_finder::SlotImp::SlotImp ( beast::ip::Endpoint remoteEndpoint,
bool fixed,
clock_type & clock )

Definition at line 33 of file SlotImp.cpp.

Member Function Documentation

◆ inbound()

bool xrpl::peer_finder::SlotImp::inbound ( ) const
overridevirtual

Returns true if this is an inbound connection.

Implements xrpl::peer_finder::Slot.

Definition at line 33 of file SlotImp.h.

◆ fixed()

bool xrpl::peer_finder::SlotImp::fixed ( ) const
overridevirtual

Returns true if this is a fixed connection.

A connection is fixed if its remote endpoint is in the list of remote endpoints for fixed connections.

Implements xrpl::peer_finder::Slot.

Definition at line 39 of file SlotImp.h.

◆ reserved() [1/2]

bool xrpl::peer_finder::SlotImp::reserved ( ) const
overridevirtual

Returns true if this is a reserved connection.

It might be a cluster peer, or a peer with a reservation. This is only known after then handshake completes.

Implements xrpl::peer_finder::Slot.

Definition at line 45 of file SlotImp.h.

◆ state() [1/2]

State xrpl::peer_finder::SlotImp::state ( ) const
overridevirtual

Returns the state of the connection.

Implements xrpl::peer_finder::Slot.

Definition at line 51 of file SlotImp.h.

◆ remoteEndpoint() [1/2]

beast::ip::Endpoint const & xrpl::peer_finder::SlotImp::remoteEndpoint ( ) const
overridevirtual

The remote endpoint of socket.

Implements xrpl::peer_finder::Slot.

Definition at line 57 of file SlotImp.h.

◆ localEndpoint() [1/2]

std::optional< beast::ip::Endpoint > const & xrpl::peer_finder::SlotImp::localEndpoint ( ) const
overridevirtual

The local endpoint of the socket, when known.

Implements xrpl::peer_finder::Slot.

Definition at line 63 of file SlotImp.h.

◆ publicKey() [1/2]

std::optional< PublicKey > const & xrpl::peer_finder::SlotImp::publicKey ( ) const
overridevirtual

The peer's public key, when known.

The public key is established when the handshake is complete.

Implements xrpl::peer_finder::Slot.

Definition at line 69 of file SlotImp.h.

◆ prefix()

std::string xrpl::peer_finder::SlotImp::prefix ( ) const

Definition at line 75 of file SlotImp.h.

◆ listeningPort()

std::optional< std::uint16_t > xrpl::peer_finder::SlotImp::listeningPort ( ) const
overridevirtual

Implements xrpl::peer_finder::Slot.

Definition at line 81 of file SlotImp.h.

◆ setListeningPort()

void xrpl::peer_finder::SlotImp::setListeningPort ( std::uint16_t port)

Definition at line 90 of file SlotImp.h.

◆ localEndpoint() [2/2]

void xrpl::peer_finder::SlotImp::localEndpoint ( beast::ip::Endpoint const & endpoint)

Definition at line 96 of file SlotImp.h.

◆ remoteEndpoint() [2/2]

void xrpl::peer_finder::SlotImp::remoteEndpoint ( beast::ip::Endpoint const & endpoint)

Definition at line 102 of file SlotImp.h.

◆ publicKey() [2/2]

void xrpl::peer_finder::SlotImp::publicKey ( PublicKey const & key)

Definition at line 108 of file SlotImp.h.

◆ reserved() [2/2]

void xrpl::peer_finder::SlotImp::reserved ( bool reserved)

Definition at line 114 of file SlotImp.h.

◆ state() [2/2]

void xrpl::peer_finder::SlotImp::state ( State state)

Definition at line 48 of file SlotImp.cpp.

◆ activate()

void xrpl::peer_finder::SlotImp::activate ( clock_type::time_point const & now)

Definition at line 81 of file SlotImp.cpp.

◆ expire()

void xrpl::peer_finder::SlotImp::expire ( )

Definition at line 160 of file SlotImp.h.

Member Data Documentation

◆ recent

class xrpl::peer_finder::SlotImp::RecentT xrpl::peer_finder::SlotImp::recent

◆ inbound_

bool const xrpl::peer_finder::SlotImp::inbound_
private

Definition at line 166 of file SlotImp.h.

◆ fixed_

bool const xrpl::peer_finder::SlotImp::fixed_
private

Definition at line 167 of file SlotImp.h.

◆ reserved_

bool xrpl::peer_finder::SlotImp::reserved_
private

Definition at line 168 of file SlotImp.h.

◆ state_

State xrpl::peer_finder::SlotImp::state_
private

Definition at line 169 of file SlotImp.h.

◆ remoteEndpoint_

beast::ip::Endpoint xrpl::peer_finder::SlotImp::remoteEndpoint_
private

Definition at line 170 of file SlotImp.h.

◆ localEndpoint_

std::optional<beast::ip::Endpoint> xrpl::peer_finder::SlotImp::localEndpoint_
private

Definition at line 171 of file SlotImp.h.

◆ publicKey_

std::optional<PublicKey> xrpl::peer_finder::SlotImp::publicKey_
private

Definition at line 172 of file SlotImp.h.

◆ kUnknownPort

std::int32_t constexpr xrpl::peer_finder::SlotImp::kUnknownPort = -1
staticconstexprprivate

Definition at line 174 of file SlotImp.h.

◆ listeningPort_

std::atomic<std::int32_t> xrpl::peer_finder::SlotImp::listeningPort_
private

Definition at line 175 of file SlotImp.h.

◆ checked

bool xrpl::peer_finder::SlotImp::checked

Definition at line 182 of file SlotImp.h.

◆ canAccept

bool xrpl::peer_finder::SlotImp::canAccept

Definition at line 186 of file SlotImp.h.

◆ connectivityCheckInProgress

bool xrpl::peer_finder::SlotImp::connectivityCheckInProgress

Definition at line 190 of file SlotImp.h.

◆ whenAcceptEndpoints

clock_type::time_point xrpl::peer_finder::SlotImp::whenAcceptEndpoints

Definition at line 196 of file SlotImp.h.