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

#include <SlotImp.h>

Inheritance diagram for xrpl::PeerFinder::SlotImp:
Collaboration diagram for xrpl::PeerFinder::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::PeerFinder::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 constexpr std::int32_t kUnknownPort = -1

Detailed Description

Definition at line 13 of file SlotImp.h.

Member Typedef Documentation

◆ ptr

Definition at line 16 of file SlotImp.h.

Member Enumeration Documentation

◆ State

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

Definition at line 16 of file peerfinder/Slot.h.

Constructor & Destructor Documentation

◆ SlotImp() [1/2]

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

Definition at line 16 of file SlotImp.cpp.

◆ SlotImp() [2/2]

xrpl::PeerFinder::SlotImp::SlotImp ( beast::IP::Endpoint remoteEndpoint,
bool fixed,
clock_type & clock )

Definition at line 35 of file SlotImp.cpp.

Member Function Documentation

◆ inbound()

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

Returns true if this is an inbound connection.

Implements xrpl::PeerFinder::Slot.

Definition at line 29 of file SlotImp.h.

◆ fixed()

bool xrpl::PeerFinder::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::PeerFinder::Slot.

Definition at line 35 of file SlotImp.h.

◆ reserved() [1/2]

bool xrpl::PeerFinder::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::PeerFinder::Slot.

Definition at line 41 of file SlotImp.h.

◆ state() [1/2]

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

Returns the state of the connection.

Implements xrpl::PeerFinder::Slot.

Definition at line 47 of file SlotImp.h.

◆ remoteEndpoint() [1/2]

beast::IP::Endpoint const & xrpl::PeerFinder::SlotImp::remoteEndpoint ( ) const
overridevirtual

The remote endpoint of socket.

Implements xrpl::PeerFinder::Slot.

Definition at line 53 of file SlotImp.h.

◆ localEndpoint() [1/2]

std::optional< beast::IP::Endpoint > const & xrpl::PeerFinder::SlotImp::localEndpoint ( ) const
overridevirtual

The local endpoint of the socket, when known.

Implements xrpl::PeerFinder::Slot.

Definition at line 59 of file SlotImp.h.

◆ publicKey() [1/2]

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

The peer's public key, when known.

The public key is established when the handshake is complete.

Implements xrpl::PeerFinder::Slot.

Definition at line 65 of file SlotImp.h.

◆ prefix()

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

Definition at line 71 of file SlotImp.h.

◆ listeningPort()

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

Implements xrpl::PeerFinder::Slot.

Definition at line 77 of file SlotImp.h.

◆ setListeningPort()

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

Definition at line 86 of file SlotImp.h.

◆ localEndpoint() [2/2]

void xrpl::PeerFinder::SlotImp::localEndpoint ( beast::IP::Endpoint const & endpoint)

Definition at line 92 of file SlotImp.h.

◆ remoteEndpoint() [2/2]

void xrpl::PeerFinder::SlotImp::remoteEndpoint ( beast::IP::Endpoint const & endpoint)

Definition at line 98 of file SlotImp.h.

◆ publicKey() [2/2]

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

Definition at line 104 of file SlotImp.h.

◆ reserved() [2/2]

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

Definition at line 110 of file SlotImp.h.

◆ state() [2/2]

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

Definition at line 50 of file SlotImp.cpp.

◆ activate()

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

Definition at line 83 of file SlotImp.cpp.

◆ expire()

void xrpl::PeerFinder::SlotImp::expire ( )

Definition at line 153 of file SlotImp.h.

Member Data Documentation

◆ recent

class xrpl::PeerFinder::SlotImp::RecentT xrpl::PeerFinder::SlotImp::recent

◆ inbound_

bool const xrpl::PeerFinder::SlotImp::inbound_
private

Definition at line 159 of file SlotImp.h.

◆ fixed_

bool const xrpl::PeerFinder::SlotImp::fixed_
private

Definition at line 160 of file SlotImp.h.

◆ reserved_

bool xrpl::PeerFinder::SlotImp::reserved_
private

Definition at line 161 of file SlotImp.h.

◆ state_

State xrpl::PeerFinder::SlotImp::state_
private

Definition at line 162 of file SlotImp.h.

◆ remoteEndpoint_

beast::IP::Endpoint xrpl::PeerFinder::SlotImp::remoteEndpoint_
private

Definition at line 163 of file SlotImp.h.

◆ localEndpoint_

std::optional<beast::IP::Endpoint> xrpl::PeerFinder::SlotImp::localEndpoint_
private

Definition at line 164 of file SlotImp.h.

◆ publicKey_

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

Definition at line 165 of file SlotImp.h.

◆ kUnknownPort

std::int32_t xrpl::PeerFinder::SlotImp::kUnknownPort = -1
staticconstexprprivate

Definition at line 167 of file SlotImp.h.

◆ listeningPort_

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

Definition at line 168 of file SlotImp.h.

◆ checked

bool xrpl::PeerFinder::SlotImp::checked

Definition at line 175 of file SlotImp.h.

◆ canAccept

bool xrpl::PeerFinder::SlotImp::canAccept

Definition at line 179 of file SlotImp.h.

◆ connectivityCheckInProgress

bool xrpl::PeerFinder::SlotImp::connectivityCheckInProgress

Definition at line 183 of file SlotImp.h.

◆ whenAcceptEndpoints

clock_type::time_point xrpl::PeerFinder::SlotImp::whenAcceptEndpoints

Definition at line 189 of file SlotImp.h.