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
OverlayImpl & operator= (OverlayImpl const &)=delete
void start () override
void stop () override
peer_finder::Manager & peerFinder ()
resource::Manager & resourceManager ()
Setup const & setup () const
Handoff onHandoff (std::unique_ptr< StreamType > &&bundle, HttpRequestType &&request, EndpointType 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 > 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< Peer > findPeerByShortID (Peer::ID const &id) const override
 Returns the peer with the matching short id, or null.
std::shared_ptr< Peer > findPeerByPublicKey (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 > relay (protocol::TMProposeSet const &m, UInt256 const &uid, PublicKey const &validator) override
 Relay a proposal.
std::set< Peer::ID > relay (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 > const &skip) override
 Relay a transaction.
std::shared_ptr< Message > getManifestsMessage ()
void addActive (std::shared_ptr< PeerImp > const &peer)
void remove (std::shared_ptr< peer_finder::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 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_t > networkID () 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 > &&peers, protocol::MessageType type)
 Updates message count for validator/peer.
void updateSlotAndSquelch (UInt256 const &key, PublicKey const &validator, Peer::ID peer, protocol::MessageType type)
 Overload to reduce allocation in case of single peer.
void deletePeer (Peer::ID 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.
Source * findOneDeep (std::string const &name)
PropertyStream::Source * findPath (std::string path)
PropertyStream::Source * findOne (std::string const &name)

Static Public Member Functions

static bool isPeerUpgrade (HttpRequestType 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 StreamType = boost::beast::ssl_stream<SocketType>

Private Types

using ClockType = std::chrono::steady_clock
using SocketType = boost::asio::ip::tcp::socket
using AddressType = boost::asio::ip::address
using EndpointType = boost::asio::ip::tcp::endpoint
using ErrorCode = boost::system::error_code

Private Member Functions

void squelch (PublicKey const &validator, Peer::ID const id, std::uint32_t squelchDuration) const override
 Squelch handler.
void unsquelch (PublicKey const &validator, Peer::ID id) const override
 Unsquelch handler.
std::shared_ptr< Writer > makeRedirectResponse (std::shared_ptr< peer_finder::Slot > const &slot, HttpRequestType const &request, AddressType remoteAddress)
bool processCrawl (HttpRequestType const &req, Handoff &handoff)
 Handles crawl requests.
bool processValidatorList (HttpRequestType const &req, Handoff &handoff)
 Handles validator list requests.
bool processHealth (HttpRequestType const &req, Handoff &handoff)
 Handles health requests.
bool processRequest (HttpRequestType 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< Writer > makeErrorResponse (std::shared_ptr< peer_finder::Slot > const &slot, HttpRequestType const &request, AddressType remoteAddress, std::string const &msg)

Private Attributes

Application & app_
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< Timer > timer_
boost::container::flat_map< Child *, std::weak_ptr< Child > > list_
Setup setup_
beast::Journal const journal_
ServerHandler & serverHandler_
resource::Manager & resourceManager_
peer_finder::StoreSqdb store_
std::unique_ptr< peer_finder::Manager > peerFinder_
TrafficCount traffic_
HashMap< std::shared_ptr< peer_finder::Slot >, std::weak_ptr< PeerImp > > peers_
HashMap< Peer::ID, std::weak_ptr< PeerImp > > ids_
Resolver & resolver_
std::atomic< Peer::ID > nextId_
int timerCount_ {0}
std::atomic< uint64_t > jqTransOverflow_ {0}
std::atomic< uint64_t > peerDisconnects_ {0}
std::atomic< uint64_t > peerDisconnectsCharges_ {0}
reduce_relay::Slots< UptimeClock > slots_
metrics::TxMetrics txMetrics_
std::shared_ptr< Message > manifestMessage_
std::optional< std::uint32_t > manifestListSeq_
std::mutex manifestLock_
Stats stats_
std::mutex statsMutex_
std::string const name_
std::recursive_mutex lock_
Item item_
Source * parent_ {nullptr}
List< Item > children_

Detailed Description

Definition at line 69 of file OverlayImpl.h.

Member Typedef Documentation

◆ ClockType

Definition at line 86 of file OverlayImpl.h.

◆ SocketType

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

Definition at line 87 of file OverlayImpl.h.

◆ AddressType

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

Definition at line 88 of file OverlayImpl.h.

◆ EndpointType

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

Definition at line 89 of file OverlayImpl.h.

◆ ErrorCode

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

Definition at line 90 of file OverlayImpl.h.

◆ StreamType

using xrpl::Overlay::StreamType = boost::beast::ssl_stream<SocketType>
protectedinherited

Definition at line 41 of file Overlay.h.

◆ PeerSequence

Definition at line 66 of file Overlay.h.

Member Enumeration Documentation

◆ Promote

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

Definition at line 51 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 168 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 511 of file OverlayImpl.cpp.

◆ stop()

void xrpl::OverlayImpl::stop ( )
overridevirtual

Reimplemented from xrpl::Overlay.

Definition at line 599 of file OverlayImpl.cpp.

◆ peerFinder()

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

Definition at line 169 of file OverlayImpl.h.

◆ resourceManager()

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

Definition at line 175 of file OverlayImpl.h.

◆ setup()

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

Definition at line 181 of file OverlayImpl.h.

◆ onHandoff()

Handoff xrpl::OverlayImpl::onHandoff ( std::unique_ptr< StreamType > && bundle,
HttpRequestType && request,
EndpointType remoteAddress )
overridevirtual

Conditionally accept an incoming HTTP request.

Implements xrpl::Overlay.

Definition at line 213 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 432 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 788 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 781 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 901 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 1124 of file OverlayImpl.cpp.

◆ getActivePeers() [2/2]

Overlay::PeerSequence xrpl::OverlayImpl::getActivePeers ( std::set< Peer::ID > 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 1135 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 1174 of file OverlayImpl.cpp.

◆ findPeerByShortID()

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

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

Implements xrpl::Overlay.

Definition at line 1180 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 1192 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 1209 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 1231 of file OverlayImpl.cpp.

◆ relay() [1/3]

std::set< Peer::ID > 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 1216 of file OverlayImpl.cpp.

◆ relay() [2/3]

std::set< Peer::ID > 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 1238 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 > 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 1328 of file OverlayImpl.cpp.

◆ getManifestsMessage()

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

Definition at line 1253 of file OverlayImpl.cpp.

◆ addActive()

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

Definition at line 471 of file OverlayImpl.cpp.

◆ remove() [1/3]

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

Definition at line 502 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 639 of file OverlayImpl.cpp.

◆ onPeerDeactivate()

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

Definition at line 660 of file OverlayImpl.cpp.

◆ forEach()

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

Definition at line 283 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 667 of file OverlayImpl.cpp.

◆ isPeerUpgrade() [1/2]

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

Definition at line 368 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 315 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 324 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 337 of file OverlayImpl.h.

◆ makePrefix()

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

Definition at line 377 of file OverlayImpl.cpp.

◆ reportInboundTraffic()

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

Definition at line 765 of file OverlayImpl.cpp.

◆ reportOutboundTraffic()

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

Definition at line 771 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 356 of file OverlayImpl.h.

◆ getJqTransOverflow()

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

Implements xrpl::Overlay.

Definition at line 362 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 368 of file OverlayImpl.h.

◆ getPeerDisconnect()

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

Implements xrpl::Overlay.

Definition at line 374 of file OverlayImpl.h.

◆ incPeerDisconnectCharges()

void xrpl::OverlayImpl::incPeerDisconnectCharges ( )
overridevirtual

Implements xrpl::Overlay.

Definition at line 380 of file OverlayImpl.h.

◆ getPeerDisconnectCharges()

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

Implements xrpl::Overlay.

Definition at line 386 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 392 of file OverlayImpl.h.

◆ updateSlotAndSquelch() [1/2]

void xrpl::OverlayImpl::updateSlotAndSquelch ( UInt256 const & key,
PublicKey const & validator,
std::set< Peer::ID > && 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 1530 of file OverlayImpl.cpp.

◆ updateSlotAndSquelch() [2/2]

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

Overload to reduce allocation in case of single peer.

Definition at line 1560 of file OverlayImpl.cpp.

◆ deletePeer()

void xrpl::OverlayImpl::deletePeer ( Peer::ID 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 1588 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 434 of file OverlayImpl.h.

◆ addTxMetrics()

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

Add tx reduce-relay metrics.

Definition at line 444 of file OverlayImpl.h.

◆ squelch()

void xrpl::OverlayImpl::squelch ( PublicKey const & validator,
Peer::ID 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 1521 of file OverlayImpl.cpp.

◆ unsquelch()

void xrpl::OverlayImpl::unsquelch ( PublicKey const & validator,
Peer::ID 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 1510 of file OverlayImpl.cpp.

◆ makeRedirectResponse()

std::shared_ptr< Writer > xrpl::OverlayImpl::makeRedirectResponse ( std::shared_ptr< peer_finder::Slot > const & slot,
HttpRequestType const & request,
AddressType remoteAddress )
private

Definition at line 385 of file OverlayImpl.cpp.

◆ makeErrorResponse()

std::shared_ptr< Writer > xrpl::OverlayImpl::makeErrorResponse ( std::shared_ptr< peer_finder::Slot > const & slot,
HttpRequestType const & request,
AddressType remoteAddress,
std::string const & msg )
staticprivate

Definition at line 412 of file OverlayImpl.cpp.

◆ processCrawl()

bool xrpl::OverlayImpl::processCrawl ( HttpRequestType 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 912 of file OverlayImpl.cpp.

◆ processValidatorList()

bool xrpl::OverlayImpl::processValidatorList ( HttpRequestType 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 948 of file OverlayImpl.cpp.

◆ processHealth()

bool xrpl::OverlayImpl::processHealth ( HttpRequestType 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 1012 of file OverlayImpl.cpp.

◆ processRequest()

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

Handles non-peer protocol requests.

Returns
true if the request was handled.

Definition at line 1116 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 794 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 838 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 865 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 871 of file OverlayImpl.cpp.

◆ onWrite()

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

Subclass override.

The default version does nothing.

Reimplemented from beast::PropertyStream::Source.

Definition at line 616 of file OverlayImpl.cpp.

◆ remove() [2/3]

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

Definition at line 1423 of file OverlayImpl.cpp.

◆ stopChildren()

void xrpl::OverlayImpl::stopChildren ( )
private

Definition at line 1432 of file OverlayImpl.cpp.

◆ autoConnect()

void xrpl::OverlayImpl::autoConnect ( )
private

Definition at line 1464 of file OverlayImpl.cpp.

◆ sendEndpoints()

void xrpl::OverlayImpl::sendEndpoints ( )
private

Definition at line 1472 of file OverlayImpl.cpp.

◆ sendTxQueue()

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

Send once a second transactions' hashes aggregated by peers.

Definition at line 1490 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 1600 of file OverlayImpl.cpp.

◆ collectMetrics()

void xrpl::OverlayImpl::collectMetrics ( )
private

Definition at line 619 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 200 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 349 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 109 of file OverlayImpl.h.

◆ ioContext_

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

Definition at line 110 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 111 of file OverlayImpl.h.

◆ strand_

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

Definition at line 112 of file OverlayImpl.h.

◆ mutex_

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

Definition at line 113 of file OverlayImpl.h.

◆ cond_

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

Definition at line 114 of file OverlayImpl.h.

◆ timer_

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

Definition at line 115 of file OverlayImpl.h.

◆ list_

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

Definition at line 116 of file OverlayImpl.h.

◆ setup_

Setup xrpl::OverlayImpl::setup_
private

Definition at line 117 of file OverlayImpl.h.

◆ journal_

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

Definition at line 118 of file OverlayImpl.h.

◆ serverHandler_

ServerHandler& xrpl::OverlayImpl::serverHandler_
private

Definition at line 119 of file OverlayImpl.h.

◆ resourceManager_

resource::Manager& xrpl::OverlayImpl::resourceManager_
private

Definition at line 120 of file OverlayImpl.h.

◆ store_

peer_finder::StoreSqdb xrpl::OverlayImpl::store_
private

Definition at line 121 of file OverlayImpl.h.

◆ peerFinder_

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

Definition at line 122 of file OverlayImpl.h.

◆ traffic_

TrafficCount xrpl::OverlayImpl::traffic_
private

Definition at line 123 of file OverlayImpl.h.

◆ peers_

HashMap<std::shared_ptr<peer_finder::Slot>, std::weak_ptr<PeerImp> > xrpl::OverlayImpl::peers_
private

Definition at line 124 of file OverlayImpl.h.

◆ ids_

HashMap<Peer::ID, std::weak_ptr<PeerImp> > xrpl::OverlayImpl::ids_
private

Definition at line 125 of file OverlayImpl.h.

◆ resolver_

Resolver& xrpl::OverlayImpl::resolver_
private

Definition at line 126 of file OverlayImpl.h.

◆ nextId_

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

Definition at line 127 of file OverlayImpl.h.

◆ timerCount_

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

Definition at line 128 of file OverlayImpl.h.

◆ jqTransOverflow_

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

Definition at line 129 of file OverlayImpl.h.

◆ peerDisconnects_

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

Definition at line 130 of file OverlayImpl.h.

◆ peerDisconnectsCharges_

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

Definition at line 131 of file OverlayImpl.h.

◆ slots_

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

Definition at line 133 of file OverlayImpl.h.

◆ txMetrics_

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

Definition at line 136 of file OverlayImpl.h.

◆ manifestMessage_

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

Definition at line 139 of file OverlayImpl.h.

◆ manifestListSeq_

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

Definition at line 141 of file OverlayImpl.h.

◆ manifestLock_

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

Definition at line 143 of file OverlayImpl.h.

◆ stats_

Stats xrpl::OverlayImpl::stats_
private

Definition at line 614 of file OverlayImpl.h.

◆ statsMutex_

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

Definition at line 615 of file OverlayImpl.h.

◆ name_

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

Definition at line 317 of file PropertyStream.h.

◆ lock_

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

Definition at line 318 of file PropertyStream.h.

◆ item_

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

Definition at line 319 of file PropertyStream.h.

◆ parent_

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

Definition at line 320 of file PropertyStream.h.

◆ children_

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

Definition at line 321 of file PropertyStream.h.