xrpld
Loading...
Searching...
No Matches
xrpl::OverlayImpl Class Reference

#include <OverlayImpl.h>

Inheritance diagram for xrpl::OverlayImpl:
Collaboration diagram for xrpl::OverlayImpl:

Classes

class  Child
struct  Timer
struct  TrafficGauges
struct  Stats

Public Types

enum class  Promote { Automatic , Never , Always }
using PeerSequence = std::vector<std::shared_ptr<Peer>>

Public Member Functions

 OverlayImpl (Application &app, Setup setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_context &ioContext, BasicConfig const &config, beast::insight::Collector::ptr const &collector)
 OverlayImpl (OverlayImpl const &)=delete
OverlayImploperator= (OverlayImpl const &)=delete
void start () override
void stop () override
PeerFinder::ManagerpeerFinder ()
Resource::ManagerresourceManager ()
Setup const & setup () const
Handoff onHandoff (std::unique_ptr< stream_type > &&bundle, http_request_type &&request, endpoint_type remoteEndpoint) override
 Conditionally accept an incoming HTTP request.
void connect (beast::IP::Endpoint const &remoteEndpoint) override
 Establish a peer connection to the specified endpoint.
int limit () override
 Returns the maximum number of peers we are configured to allow.
std::size_t size () const override
 The number of active peers on the network Active peers are only those peers that have completed the handshake and are running the XRPL protocol.
json::Value json () override
 Return diagnostics on the status of all peers.
PeerSequence getActivePeers () const override
 Returns a sequence representing the current list of peers.
PeerSequence getActivePeers (std::set< Peer::id_t > const &toSkip, std::size_t &active, std::size_t &disabled, std::size_t &enabledInSkip) const
 Get active peers excluding peers in toSkip.
void checkTracking (std::uint32_t) override
 Calls the checkTracking function on each peer.
std::shared_ptr< PeerfindPeerByShortID (Peer::id_t const &id) const override
 Returns the peer with the matching short id, or null.
std::shared_ptr< PeerfindPeerByPublicKey (PublicKey const &pubKey) override
 Returns the peer with the matching public key, or null.
void broadcast (protocol::TMProposeSet const &m) override
 Broadcast a proposal.
void broadcast (protocol::TMValidation const &m) override
 Broadcast a validation.
std::set< Peer::id_trelay (protocol::TMProposeSet const &m, uint256 const &uid, PublicKey const &validator) override
 Relay a proposal.
std::set< Peer::id_trelay (protocol::TMValidation const &m, uint256 const &uid, PublicKey const &validator) override
 Relay a validation.
void relay (uint256 const &, std::optional< std::reference_wrapper< protocol::TMTransaction > > m, std::set< Peer::id_t > const &skip) override
 Relay a transaction.
std::shared_ptr< MessagegetManifestsMessage ()
void addActive (std::shared_ptr< PeerImp > const &peer)
void remove (std::shared_ptr< PeerFinder::Slot > const &slot)
void activate (std::shared_ptr< PeerImp > const &peer)
 Called when a peer has connected successfully This is called after the peer handshake has been completed and during peer activation.
void onPeerDeactivate (Peer::id_t id)
template<class UnaryFunc>
void forEach (UnaryFunc &&f) const
void onManifests (std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
void reportInboundTraffic (TrafficCount::Category cat, int bytes)
void reportOutboundTraffic (TrafficCount::Category cat, int bytes)
void incJqTransOverflow () override
 Increment and retrieve counter for transaction job queue overflows.
std::uint64_t getJqTransOverflow () const override
void incPeerDisconnect () override
 Increment and retrieve counters for total peer disconnects, and disconnects we initiate for excessive resource consumption.
std::uint64_t getPeerDisconnect () const override
void incPeerDisconnectCharges () override
std::uint64_t getPeerDisconnectCharges () const override
std::optional< std::uint32_tnetworkID () const override
 Returns the ID of the network this server is configured for, if any.
void updateSlotAndSquelch (uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
 Updates message count for validator/peer.
void updateSlotAndSquelch (uint256 const &key, PublicKey const &validator, Peer::id_t peer, protocol::MessageType type)
 Overload to reduce allocation in case of single peer.
void deletePeer (Peer::id_t id)
 Called when the peer is deleted.
json::Value txMetrics () const override
 Returns tx reduce-relay metrics.
template<typename... Args>
void addTxMetrics (Args... args)
 Add tx reduce-relay metrics.
template<class Function>
void foreach (Function f) const
 Visit every active peer.
std::string const & name () const
 Returns the name of this source.
void add (Source &source)
 Add a child source.
template<class Derived>
Derived * add (Derived *child)
 Add a child source by pointer.
void remove (Source &child)
 Remove a child source from this Source.
void removeAll ()
 Remove all child sources from this Source.
void writeOne (PropertyStream &stream)
 Write only this Source to the stream.
void write (PropertyStream &stream)
 write this source and all its children recursively to the stream.
void write (PropertyStream &stream, std::string const &path)
 Parse the path and write the corresponding Source and optional children.
std::pair< Source *, bool > find (std::string path)
 Parse the dot-delimited Source path and return the result.
SourcefindOneDeep (std::string const &name)
PropertyStream::Source * findPath (std::string path)
PropertyStream::Source * findOne (std::string const &name)

Static Public Member Functions

static bool isPeerUpgrade (http_request_type const &request)
template<class Body>
static bool isPeerUpgrade (boost::beast::http::response< Body > const &response)
template<class Fields>
static bool isUpgrade (boost::beast::http::header< true, Fields > const &req)
template<class Fields>
static bool isUpgrade (boost::beast::http::header< false, Fields > const &req)
static std::string makePrefix (std::uint32_t id)
static bool peelLeadingSlash (std::string *path)
static bool peelTrailingSlashstar (std::string *path)
static std::string peelName (std::string *path)

Protected Types

using stream_type = boost::beast::ssl_stream<socket_type>

Private Types

using clock_type = std::chrono::steady_clock
using socket_type = boost::asio::ip::tcp::socket
using address_type = boost::asio::ip::address
using endpoint_type = boost::asio::ip::tcp::endpoint
using error_code = boost::system::error_code

Private Member Functions

void squelch (PublicKey const &validator, Peer::id_t const id, std::uint32_t squelchDuration) const override
 Squelch handler.
void unsquelch (PublicKey const &validator, Peer::id_t id) const override
 Unsquelch handler.
std::shared_ptr< WritermakeRedirectResponse (std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remoteAddress)
bool processCrawl (http_request_type const &req, Handoff &handoff)
 Handles crawl requests.
bool processValidatorList (http_request_type const &req, Handoff &handoff)
 Handles validator list requests.
bool processHealth (http_request_type const &req, Handoff &handoff)
 Handles health requests.
bool processRequest (http_request_type const &req, Handoff &handoff)
 Handles non-peer protocol requests.
json::Value getOverlayInfo () const
 Returns information about peers on the overlay network.
json::Value getServerInfo ()
 Returns information about the local server.
json::Value getServerCounts ()
 Returns information about the local server's performance counters.
json::Value getUnlInfo ()
 Returns information about the local server's UNL.
void onWrite (beast::PropertyStream::Map &stream) override
 Subclass override.
void remove (Child &child)
void stopChildren ()
void autoConnect ()
void sendEndpoints ()
void sendTxQueue () const
 Send once a second transactions' hashes aggregated by peers.
void deleteIdlePeers ()
 Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
void collectMetrics ()

Static Private Member Functions

static std::shared_ptr< WritermakeErrorResponse (std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remoteAddress, std::string const &msg)

Private Attributes

Applicationapp_
boost::asio::io_context & ioContext_
std::optional< boost::asio::executor_work_guard< boost::asio::io_context::executor_type > > work_
boost::asio::strand< boost::asio::io_context::executor_type > strand_
std::recursive_mutex mutex_
std::condition_variable_any cond_
std::weak_ptr< Timertimer_
boost::container::flat_map< Child *, std::weak_ptr< Child > > list_
Setup setup_
beast::Journal const journal_
ServerHandlerserverHandler_
Resource::ManagerresourceManager_
std::unique_ptr< PeerFinder::ManagerpeerFinder_
TrafficCount traffic_
hash_map< std::shared_ptr< PeerFinder::Slot >, std::weak_ptr< PeerImp > > peers_
hash_map< Peer::id_t, std::weak_ptr< PeerImp > > ids_
Resolverresolver_
std::atomic< Peer::id_tnextId_
int timerCount_ {0}
std::atomic< uint64_t > jqTransOverflow_ {0}
std::atomic< uint64_t > peerDisconnects_ {0}
std::atomic< uint64_t > peerDisconnectsCharges_ {0}
reduce_relay::Slots< UptimeClockslots_
metrics::TxMetrics txMetrics_
std::shared_ptr< MessagemanifestMessage_
std::optional< std::uint32_tmanifestListSeq_
std::mutex manifestLock_
Stats stats_
std::mutex statsMutex_
std::string const name_
std::recursive_mutex lock_
Item item_
Sourceparent_ {nullptr}
List< Item > children_

Detailed Description

Definition at line 42 of file OverlayImpl.h.

Member Typedef Documentation

◆ clock_type

Definition at line 59 of file OverlayImpl.h.

◆ socket_type

using xrpl::OverlayImpl::socket_type = boost::asio::ip::tcp::socket
private

Definition at line 60 of file OverlayImpl.h.

◆ address_type

using xrpl::OverlayImpl::address_type = boost::asio::ip::address
private

Definition at line 61 of file OverlayImpl.h.

◆ endpoint_type

using xrpl::OverlayImpl::endpoint_type = boost::asio::ip::tcp::endpoint
private

Definition at line 62 of file OverlayImpl.h.

◆ error_code

using xrpl::OverlayImpl::error_code = boost::system::error_code
private

Definition at line 63 of file OverlayImpl.h.

◆ stream_type

using xrpl::Overlay::stream_type = boost::beast::ssl_stream<socket_type>
protectedinherited

Definition at line 28 of file Overlay.h.

◆ PeerSequence

Definition at line 53 of file Overlay.h.

Member Enumeration Documentation

◆ Promote

enum class xrpl::Overlay::Promote
stronginherited
Enumerator
Automatic 
Never 
Always 

Definition at line 38 of file Overlay.h.

Constructor & Destructor Documentation

◆ OverlayImpl() [1/2]

xrpl::OverlayImpl::OverlayImpl ( Application & app,
Setup setup,
ServerHandler & serverHandler,
Resource::Manager & resourceManager,
Resolver & resolver,
boost::asio::io_context & ioContext,
BasicConfig const & config,
beast::insight::Collector::ptr const & collector )

Definition at line 165 of file OverlayImpl.cpp.

◆ OverlayImpl() [2/2]

xrpl::OverlayImpl::OverlayImpl ( OverlayImpl const & )
delete

Member Function Documentation

◆ operator=()

OverlayImpl & xrpl::OverlayImpl::operator= ( OverlayImpl const & )
delete

◆ start()

void xrpl::OverlayImpl::start ( )
overridevirtual

Reimplemented from xrpl::Overlay.

Definition at line 506 of file OverlayImpl.cpp.

◆ stop()

void xrpl::OverlayImpl::stop ( )
overridevirtual

Reimplemented from xrpl::Overlay.

Definition at line 594 of file OverlayImpl.cpp.

◆ peerFinder()

PeerFinder::Manager & xrpl::OverlayImpl::peerFinder ( )

Definition at line 141 of file OverlayImpl.h.

◆ resourceManager()

Resource::Manager & xrpl::OverlayImpl::resourceManager ( )

Definition at line 147 of file OverlayImpl.h.

◆ setup()

Setup const & xrpl::OverlayImpl::setup ( ) const

Definition at line 153 of file OverlayImpl.h.

◆ onHandoff()

Handoff xrpl::OverlayImpl::onHandoff ( std::unique_ptr< stream_type > && bundle,
http_request_type && request,
endpoint_type remoteAddress )
overridevirtual

Conditionally accept an incoming HTTP request.

Implements xrpl::Overlay.

Definition at line 208 of file OverlayImpl.cpp.

◆ connect()

void xrpl::OverlayImpl::connect ( beast::IP::Endpoint const & address)
overridevirtual

Establish a peer connection to the specified endpoint.

The call returns immediately, the connection attempt is performed asynchronously.

Implements xrpl::Overlay.

Definition at line 427 of file OverlayImpl.cpp.

◆ limit()

int xrpl::OverlayImpl::limit ( )
overridevirtual

Returns the maximum number of peers we are configured to allow.

Implements xrpl::Overlay.

Definition at line 740 of file OverlayImpl.cpp.

◆ size()

std::size_t xrpl::OverlayImpl::size ( ) const
overridevirtual

The number of active peers on the network Active peers are only those peers that have completed the handshake and are running the XRPL protocol.

Implements xrpl::Overlay.

Definition at line 733 of file OverlayImpl.cpp.

◆ json()

json::Value xrpl::OverlayImpl::json ( )
overridevirtual

Return diagnostics on the status of all peers.

Implements xrpl::Overlay.

Definition at line 853 of file OverlayImpl.cpp.

◆ getActivePeers() [1/2]

Overlay::PeerSequence xrpl::OverlayImpl::getActivePeers ( ) const
overridevirtual

Returns a sequence representing the current list of peers.

The snapshot is made at the time of the call.

Implements xrpl::Overlay.

Definition at line 1076 of file OverlayImpl.cpp.

◆ getActivePeers() [2/2]

Overlay::PeerSequence xrpl::OverlayImpl::getActivePeers ( std::set< Peer::id_t > const & toSkip,
std::size_t & active,
std::size_t & disabled,
std::size_t & enabledInSkip ) const

Get active peers excluding peers in toSkip.

Parameters
toSkippeers to skip
activea number of active peers
disableda number of peers with tx reduce-relay feature disabled
enabledInSkipa number of peers with tx reduce-relay feature enabled and in toSkip
Returns
active peers less peers in toSkip

Definition at line 1087 of file OverlayImpl.cpp.

◆ checkTracking()

void xrpl::OverlayImpl::checkTracking ( std::uint32_t index)
overridevirtual

Calls the checkTracking function on each peer.

Parameters
indexthe value to pass to the peer's checkTracking function

Implements xrpl::Overlay.

Definition at line 1126 of file OverlayImpl.cpp.

◆ findPeerByShortID()

std::shared_ptr< Peer > xrpl::OverlayImpl::findPeerByShortID ( Peer::id_t const & id) const
overridevirtual

Returns the peer with the matching short id, or null.

Implements xrpl::Overlay.

Definition at line 1132 of file OverlayImpl.cpp.

◆ findPeerByPublicKey()

std::shared_ptr< Peer > xrpl::OverlayImpl::findPeerByPublicKey ( PublicKey const & pubKey)
overridevirtual

Returns the peer with the matching public key, or null.

Implements xrpl::Overlay.

Definition at line 1144 of file OverlayImpl.cpp.

◆ broadcast() [1/2]

void xrpl::OverlayImpl::broadcast ( protocol::TMProposeSet const & m)
overridevirtual

Broadcast a proposal.

Implements xrpl::Overlay.

Definition at line 1161 of file OverlayImpl.cpp.

◆ broadcast() [2/2]

void xrpl::OverlayImpl::broadcast ( protocol::TMValidation const & m)
overridevirtual

Broadcast a validation.

Implements xrpl::Overlay.

Definition at line 1183 of file OverlayImpl.cpp.

◆ relay() [1/3]

std::set< Peer::id_t > xrpl::OverlayImpl::relay ( protocol::TMProposeSet const & m,
uint256 const & uid,
PublicKey const & validator )
overridevirtual

Relay a proposal.

Parameters
mthe serialized proposal
uidthe id used to identify this proposal
validatorThe pubkey of the validator that issued this proposal
Returns
the set of peers which have already sent us this proposal

Implements xrpl::Overlay.

Definition at line 1168 of file OverlayImpl.cpp.

◆ relay() [2/3]

std::set< Peer::id_t > xrpl::OverlayImpl::relay ( protocol::TMValidation const & m,
uint256 const & uid,
PublicKey const & validator )
overridevirtual

Relay a validation.

Parameters
mthe serialized validation
uidthe id used to identify this validation
validatorThe pubkey of the validator that issued this validation
Returns
the set of peers which have already sent us this validation

Implements xrpl::Overlay.

Definition at line 1190 of file OverlayImpl.cpp.

◆ relay() [3/3]

void xrpl::OverlayImpl::relay ( uint256 const & hash,
std::optional< std::reference_wrapper< protocol::TMTransaction > > m,
std::set< Peer::id_t > const & toSkip )
overridevirtual

Relay a transaction.

If the tx reduce-relay feature is enabled then randomly select peers to relay to and queue transaction's hash for the rest of the peers.

Parameters
hashtransaction's hash
mtransaction's protocol message to relay
toSkippeers which have already seen this transaction

Implements xrpl::Overlay.

Definition at line 1232 of file OverlayImpl.cpp.

◆ getManifestsMessage()

std::shared_ptr< Message > xrpl::OverlayImpl::getManifestsMessage ( )

Definition at line 1205 of file OverlayImpl.cpp.

◆ addActive()

void xrpl::OverlayImpl::addActive ( std::shared_ptr< PeerImp > const & peer)

Definition at line 466 of file OverlayImpl.cpp.

◆ remove() [1/3]

void xrpl::OverlayImpl::remove ( std::shared_ptr< PeerFinder::Slot > const & slot)

Definition at line 497 of file OverlayImpl.cpp.

◆ activate()

void xrpl::OverlayImpl::activate ( std::shared_ptr< PeerImp > const & peer)

Called when a peer has connected successfully This is called after the peer handshake has been completed and during peer activation.

A peer has connected successfully This is called after the peer handshake has been completed and during peer activation.

At this point, the peer address and the public key are known.

Definition at line 633 of file OverlayImpl.cpp.

◆ onPeerDeactivate()

void xrpl::OverlayImpl::onPeerDeactivate ( Peer::id_t id)

Definition at line 654 of file OverlayImpl.cpp.

◆ forEach()

template<class UnaryFunc>
void xrpl::OverlayImpl::forEach ( UnaryFunc && f) const

Definition at line 253 of file OverlayImpl.h.

◆ onManifests()

void xrpl::OverlayImpl::onManifests ( std::shared_ptr< protocol::TMManifests > const & m,
std::shared_ptr< PeerImp > const & from )

Definition at line 661 of file OverlayImpl.cpp.

◆ isPeerUpgrade() [1/2]

bool xrpl::OverlayImpl::isPeerUpgrade ( http_request_type const & request)
static

Definition at line 363 of file OverlayImpl.cpp.

◆ isPeerUpgrade() [2/2]

template<class Body>
bool xrpl::OverlayImpl::isPeerUpgrade ( boost::beast::http::response< Body > const & response)
static

Definition at line 285 of file OverlayImpl.h.

◆ isUpgrade() [1/2]

template<class Fields>
bool xrpl::OverlayImpl::isUpgrade ( boost::beast::http::header< true, Fields > const & req)
static

Definition at line 294 of file OverlayImpl.h.

◆ isUpgrade() [2/2]

template<class Fields>
bool xrpl::OverlayImpl::isUpgrade ( boost::beast::http::header< false, Fields > const & req)
static

Definition at line 307 of file OverlayImpl.h.

◆ makePrefix()

std::string xrpl::OverlayImpl::makePrefix ( std::uint32_t id)
static

Definition at line 372 of file OverlayImpl.cpp.

◆ reportInboundTraffic()

void xrpl::OverlayImpl::reportInboundTraffic ( TrafficCount::Category cat,
int bytes )

Definition at line 718 of file OverlayImpl.cpp.

◆ reportOutboundTraffic()

void xrpl::OverlayImpl::reportOutboundTraffic ( TrafficCount::Category cat,
int bytes )

Definition at line 724 of file OverlayImpl.cpp.

◆ incJqTransOverflow()

void xrpl::OverlayImpl::incJqTransOverflow ( )
overridevirtual

Increment and retrieve counter for transaction job queue overflows.

Implements xrpl::Overlay.

Definition at line 326 of file OverlayImpl.h.

◆ getJqTransOverflow()

std::uint64_t xrpl::OverlayImpl::getJqTransOverflow ( ) const
overridevirtual

Implements xrpl::Overlay.

Definition at line 332 of file OverlayImpl.h.

◆ incPeerDisconnect()

void xrpl::OverlayImpl::incPeerDisconnect ( )
overridevirtual

Increment and retrieve counters for total peer disconnects, and disconnects we initiate for excessive resource consumption.

Implements xrpl::Overlay.

Definition at line 338 of file OverlayImpl.h.

◆ getPeerDisconnect()

std::uint64_t xrpl::OverlayImpl::getPeerDisconnect ( ) const
overridevirtual

Implements xrpl::Overlay.

Definition at line 344 of file OverlayImpl.h.

◆ incPeerDisconnectCharges()

void xrpl::OverlayImpl::incPeerDisconnectCharges ( )
overridevirtual

Implements xrpl::Overlay.

Definition at line 350 of file OverlayImpl.h.

◆ getPeerDisconnectCharges()

std::uint64_t xrpl::OverlayImpl::getPeerDisconnectCharges ( ) const
overridevirtual

Implements xrpl::Overlay.

Definition at line 356 of file OverlayImpl.h.

◆ networkID()

std::optional< std::uint32_t > xrpl::OverlayImpl::networkID ( ) const
overridevirtual

Returns the ID of the network this server is configured for, if any.

The ID is just a numerical identifier, with the IDs 0, 1 and 2 used to identify the mainnet, the testnet and the devnet respectively.

Returns
The numerical identifier configured by the administrator of the server. An unseated optional, otherwise.

Implements xrpl::Overlay.

Definition at line 362 of file OverlayImpl.h.

◆ updateSlotAndSquelch() [1/2]

void xrpl::OverlayImpl::updateSlotAndSquelch ( uint256 const & key,
PublicKey const & validator,
std::set< Peer::id_t > && peers,
protocol::MessageType type )

Updates message count for validator/peer.

Sends TMSquelch if the number of messages for N peers reaches threshold T. A message is counted if a peer receives the message for the first time and if the message has been relayed.

Parameters
keyUnique message's key
validatorValidator's public key
peersPeers' id to update the slots for
typeReceived protocol message type

Definition at line 1431 of file OverlayImpl.cpp.

◆ updateSlotAndSquelch() [2/2]

void xrpl::OverlayImpl::updateSlotAndSquelch ( uint256 const & key,
PublicKey const & validator,
Peer::id_t peer,
protocol::MessageType type )

Overload to reduce allocation in case of single peer.

Definition at line 1461 of file OverlayImpl.cpp.

◆ deletePeer()

void xrpl::OverlayImpl::deletePeer ( Peer::id_t id)

Called when the peer is deleted.

If the peer was selected to be the source of messages from the validator then squelched peers have to be unsquelched.

Parameters
idPeer's id

Definition at line 1489 of file OverlayImpl.cpp.

◆ txMetrics()

json::Value xrpl::OverlayImpl::txMetrics ( ) const
overridevirtual

Returns tx reduce-relay metrics.

Returns
json value of tx reduce-relay metrics

Implements xrpl::Overlay.

Definition at line 401 of file OverlayImpl.h.

◆ addTxMetrics()

template<typename... Args>
void xrpl::OverlayImpl::addTxMetrics ( Args... args)

Add tx reduce-relay metrics.

Definition at line 409 of file OverlayImpl.h.

◆ squelch()

void xrpl::OverlayImpl::squelch ( PublicKey const & validator,
Peer::id_t const id,
std::uint32_t duration ) const
overrideprivatevirtual

Squelch handler.

Parameters
validatorPublic key of the source validator
idPeer's id to squelch
durationSquelch duration in seconds

Implements xrpl::reduce_relay::SquelchHandler.

Definition at line 1422 of file OverlayImpl.cpp.

◆ unsquelch()

void xrpl::OverlayImpl::unsquelch ( PublicKey const & validator,
Peer::id_t id ) const
overrideprivatevirtual

Unsquelch handler.

Parameters
validatorPublic key of the source validator
idPeer's id to unsquelch

Implements xrpl::reduce_relay::SquelchHandler.

Definition at line 1411 of file OverlayImpl.cpp.

◆ makeRedirectResponse()

std::shared_ptr< Writer > xrpl::OverlayImpl::makeRedirectResponse ( std::shared_ptr< PeerFinder::Slot > const & slot,
http_request_type const & request,
address_type remoteAddress )
private

Definition at line 380 of file OverlayImpl.cpp.

◆ makeErrorResponse()

std::shared_ptr< Writer > xrpl::OverlayImpl::makeErrorResponse ( std::shared_ptr< PeerFinder::Slot > const & slot,
http_request_type const & request,
address_type remoteAddress,
std::string const & msg )
staticprivate

Definition at line 407 of file OverlayImpl.cpp.

◆ processCrawl()

bool xrpl::OverlayImpl::processCrawl ( http_request_type const & req,
Handoff & handoff )
private

Handles crawl requests.

Crawl returns information about the node and its peers so crawlers can map the network.

Returns
true if the request was handled.

Definition at line 864 of file OverlayImpl.cpp.

◆ processValidatorList()

bool xrpl::OverlayImpl::processValidatorList ( http_request_type const & req,
Handoff & handoff )
private

Handles validator list requests.

Using a /vl/<hex-encoded public key> URL, will retrieve the latest validator list (or UNL) that this node has for that public key, if the node trusts that public key.

Returns
true if the request was handled.

Definition at line 900 of file OverlayImpl.cpp.

◆ processHealth()

bool xrpl::OverlayImpl::processHealth ( http_request_type const & req,
Handoff & handoff )
private

Handles health requests.

Health returns information about the health of the node.

Returns
true if the request was handled.

Definition at line 964 of file OverlayImpl.cpp.

◆ processRequest()

bool xrpl::OverlayImpl::processRequest ( http_request_type const & req,
Handoff & handoff )
private

Handles non-peer protocol requests.

Returns
true if the request was handled.

Definition at line 1068 of file OverlayImpl.cpp.

◆ getOverlayInfo()

json::Value xrpl::OverlayImpl::getOverlayInfo ( ) const
private

Returns information about peers on the overlay network.

Reported through the /crawl API Controlled through the config section [crawl] overlay=[0|1]

Definition at line 746 of file OverlayImpl.cpp.

◆ getServerInfo()

json::Value xrpl::OverlayImpl::getServerInfo ( )
private

Returns information about the local server.

Reported through the /crawl API Controlled through the config section [crawl] server=[0|1]

Definition at line 790 of file OverlayImpl.cpp.

◆ getServerCounts()

json::Value xrpl::OverlayImpl::getServerCounts ( )
private

Returns information about the local server's performance counters.

Reported through the /crawl API Controlled through the config section [crawl] counts=[0|1]

Definition at line 817 of file OverlayImpl.cpp.

◆ getUnlInfo()

json::Value xrpl::OverlayImpl::getUnlInfo ( )
private

Returns information about the local server's UNL.

Reported through the /crawl API Controlled through the config section [crawl] unl=[0|1]

Definition at line 823 of file OverlayImpl.cpp.

◆ onWrite()

void xrpl::OverlayImpl::onWrite ( beast::PropertyStream::Map & )
overrideprivatevirtual

Subclass override.

The default version does nothing.

Reimplemented from beast::PropertyStream::Source.

Definition at line 611 of file OverlayImpl.cpp.

◆ remove() [2/3]

void xrpl::OverlayImpl::remove ( Child & child)
private

Definition at line 1324 of file OverlayImpl.cpp.

◆ stopChildren()

void xrpl::OverlayImpl::stopChildren ( )
private

Definition at line 1333 of file OverlayImpl.cpp.

◆ autoConnect()

void xrpl::OverlayImpl::autoConnect ( )
private

Definition at line 1365 of file OverlayImpl.cpp.

◆ sendEndpoints()

void xrpl::OverlayImpl::sendEndpoints ( )
private

Definition at line 1373 of file OverlayImpl.cpp.

◆ sendTxQueue()

void xrpl::OverlayImpl::sendTxQueue ( ) const
private

Send once a second transactions' hashes aggregated by peers.

Definition at line 1391 of file OverlayImpl.cpp.

◆ deleteIdlePeers()

void xrpl::OverlayImpl::deleteIdlePeers ( )
private

Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.

Definition at line 1501 of file OverlayImpl.cpp.

◆ collectMetrics()

void xrpl::OverlayImpl::collectMetrics ( )
private

Definition at line 572 of file OverlayImpl.h.

◆ foreach()

template<class Function>
void xrpl::Overlay::foreach ( Function f) const
inherited

Visit every active peer.

The visitor must be invocable as: Function(std::shared_ptr<Peer> const& peer);

Parameters
fthe invocable to call with every peer

Definition at line 166 of file Overlay.h.

◆ name()

std::string const & beast::PropertyStream::Source::name ( ) const
nodiscardinherited

Returns the name of this source.

Definition at line 168 of file beast_PropertyStream.cpp.

◆ add() [1/2]

void beast::PropertyStream::Source::add ( Source & source)
inherited

Add a child source.

Definition at line 174 of file beast_PropertyStream.cpp.

◆ add() [2/2]

template<class Derived>
Derived * beast::PropertyStream::Source::add ( Derived * child)
inherited

Add a child source by pointer.

The source pointer is returned so it can be used in ctor-initializers.

Definition at line 338 of file PropertyStream.h.

◆ remove() [3/3]

void beast::PropertyStream::Source::remove ( Source & child)
inherited

Remove a child source from this Source.

Definition at line 185 of file beast_PropertyStream.cpp.

◆ removeAll()

void beast::PropertyStream::Source::removeAll ( )
inherited

Remove all child sources from this Source.

Definition at line 196 of file beast_PropertyStream.cpp.

◆ writeOne()

void beast::PropertyStream::Source::writeOne ( PropertyStream & stream)
inherited

Write only this Source to the stream.

Definition at line 209 of file beast_PropertyStream.cpp.

◆ write() [1/2]

void beast::PropertyStream::Source::write ( PropertyStream & stream)
inherited

write this source and all its children recursively to the stream.

Definition at line 216 of file beast_PropertyStream.cpp.

◆ write() [2/2]

void beast::PropertyStream::Source::write ( PropertyStream & stream,
std::string const & path )
inherited

Parse the path and write the corresponding Source and optional children.

If the source is found, it is written. If the wildcard character '*' exists as the last character in the path, then all the children are written recursively.

Definition at line 228 of file beast_PropertyStream.cpp.

◆ find()

std::pair< PropertyStream::Source *, bool > beast::PropertyStream::Source::find ( std::string path)
inherited

Parse the dot-delimited Source path and return the result.

The first value will be a pointer to the Source object corresponding to the given path. If no Source object exists, then the first value will be nullptr and the second value will be undefined. The second value is a boolean indicating whether or not the path string specifies the wildcard character '*' as the last character.

print statement examples "parent.child" prints child and all of its children "parent.child." start at the parent and print down to child "parent.grandchild" prints nothing- grandchild not direct descendent "parent.grandchild." starts at the parent and prints down to grandchild "parent.grandchild.*" starts at parent, print through grandchild children

Definition at line 246 of file beast_PropertyStream.cpp.

◆ findOneDeep()

PropertyStream::Source * beast::PropertyStream::Source::findOneDeep ( std::string const & name)
inherited

Definition at line 317 of file beast_PropertyStream.cpp.

◆ findPath()

PropertyStream::Source * beast::PropertyStream::Source::findPath ( std::string path)
inherited

Definition at line 334 of file beast_PropertyStream.cpp.

◆ findOne()

PropertyStream::Source * beast::PropertyStream::Source::findOne ( std::string const & name)
inherited

Definition at line 352 of file beast_PropertyStream.cpp.

◆ peelLeadingSlash()

bool beast::PropertyStream::Source::peelLeadingSlash ( std::string * path)
staticinherited

Definition at line 266 of file beast_PropertyStream.cpp.

◆ peelTrailingSlashstar()

bool beast::PropertyStream::Source::peelTrailingSlashstar ( std::string * path)
staticinherited

Definition at line 277 of file beast_PropertyStream.cpp.

◆ peelName()

std::string beast::PropertyStream::Source::peelName ( std::string * path)
staticinherited

Definition at line 293 of file beast_PropertyStream.cpp.

Member Data Documentation

◆ app_

Application& xrpl::OverlayImpl::app_
private

Definition at line 82 of file OverlayImpl.h.

◆ ioContext_

boost::asio::io_context& xrpl::OverlayImpl::ioContext_
private

Definition at line 83 of file OverlayImpl.h.

◆ work_

std::optional<boost::asio::executor_work_guard<boost::asio::io_context::executor_type> > xrpl::OverlayImpl::work_
private

Definition at line 84 of file OverlayImpl.h.

◆ strand_

boost::asio::strand<boost::asio::io_context::executor_type> xrpl::OverlayImpl::strand_
private

Definition at line 85 of file OverlayImpl.h.

◆ mutex_

std::recursive_mutex xrpl::OverlayImpl::mutex_
mutableprivate

Definition at line 86 of file OverlayImpl.h.

◆ cond_

std::condition_variable_any xrpl::OverlayImpl::cond_
private

Definition at line 87 of file OverlayImpl.h.

◆ timer_

std::weak_ptr<Timer> xrpl::OverlayImpl::timer_
private

Definition at line 88 of file OverlayImpl.h.

◆ list_

boost::container::flat_map<Child*, std::weak_ptr<Child> > xrpl::OverlayImpl::list_
private

Definition at line 89 of file OverlayImpl.h.

◆ setup_

Setup xrpl::OverlayImpl::setup_
private

Definition at line 90 of file OverlayImpl.h.

◆ journal_

beast::Journal const xrpl::OverlayImpl::journal_
private

Definition at line 91 of file OverlayImpl.h.

◆ serverHandler_

ServerHandler& xrpl::OverlayImpl::serverHandler_
private

Definition at line 92 of file OverlayImpl.h.

◆ resourceManager_

Resource::Manager& xrpl::OverlayImpl::resourceManager_
private

Definition at line 93 of file OverlayImpl.h.

◆ peerFinder_

std::unique_ptr<PeerFinder::Manager> xrpl::OverlayImpl::peerFinder_
private

Definition at line 94 of file OverlayImpl.h.

◆ traffic_

TrafficCount xrpl::OverlayImpl::traffic_
private

Definition at line 95 of file OverlayImpl.h.

◆ peers_

hash_map<std::shared_ptr<PeerFinder::Slot>, std::weak_ptr<PeerImp> > xrpl::OverlayImpl::peers_
private

Definition at line 96 of file OverlayImpl.h.

◆ ids_

hash_map<Peer::id_t, std::weak_ptr<PeerImp> > xrpl::OverlayImpl::ids_
private

Definition at line 97 of file OverlayImpl.h.

◆ resolver_

Resolver& xrpl::OverlayImpl::resolver_
private

Definition at line 98 of file OverlayImpl.h.

◆ nextId_

std::atomic<Peer::id_t> xrpl::OverlayImpl::nextId_
private

Definition at line 99 of file OverlayImpl.h.

◆ timerCount_

int xrpl::OverlayImpl::timerCount_ {0}
private

Definition at line 100 of file OverlayImpl.h.

◆ jqTransOverflow_

std::atomic<uint64_t> xrpl::OverlayImpl::jqTransOverflow_ {0}
private

Definition at line 101 of file OverlayImpl.h.

◆ peerDisconnects_

std::atomic<uint64_t> xrpl::OverlayImpl::peerDisconnects_ {0}
private

Definition at line 102 of file OverlayImpl.h.

◆ peerDisconnectsCharges_

std::atomic<uint64_t> xrpl::OverlayImpl::peerDisconnectsCharges_ {0}
private

Definition at line 103 of file OverlayImpl.h.

◆ slots_

reduce_relay::Slots<UptimeClock> xrpl::OverlayImpl::slots_
private

Definition at line 105 of file OverlayImpl.h.

◆ txMetrics_

metrics::TxMetrics xrpl::OverlayImpl::txMetrics_
private

Definition at line 108 of file OverlayImpl.h.

◆ manifestMessage_

std::shared_ptr<Message> xrpl::OverlayImpl::manifestMessage_
private

Definition at line 111 of file OverlayImpl.h.

◆ manifestListSeq_

std::optional<std::uint32_t> xrpl::OverlayImpl::manifestListSeq_
private

Definition at line 113 of file OverlayImpl.h.

◆ manifestLock_

std::mutex xrpl::OverlayImpl::manifestLock_
private

Definition at line 115 of file OverlayImpl.h.

◆ stats_

Stats xrpl::OverlayImpl::stats_
private

Definition at line 567 of file OverlayImpl.h.

◆ statsMutex_

std::mutex xrpl::OverlayImpl::statsMutex_
private

Definition at line 568 of file OverlayImpl.h.

◆ name_

std::string const beast::PropertyStream::Source::name_
privateinherited

Definition at line 311 of file PropertyStream.h.

◆ lock_

std::recursive_mutex beast::PropertyStream::Source::lock_
privateinherited

Definition at line 312 of file PropertyStream.h.

◆ item_

Item beast::PropertyStream::Source::item_
privateinherited

Definition at line 313 of file PropertyStream.h.

◆ parent_

Source* beast::PropertyStream::Source::parent_ {nullptr}
privateinherited

Definition at line 314 of file PropertyStream.h.

◆ children_

List<Item> beast::PropertyStream::Source::children_
privateinherited

Definition at line 315 of file PropertyStream.h.