rippled
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Private Types | Private Member Functions | Private Attributes | List of all members
ripple::OverlayImpl Class Reference
Inheritance diagram for ripple::OverlayImpl:
Inheritance graph
[legend]
Collaboration diagram for ripple::OverlayImpl:
Collaboration graph
[legend]

Classes

class  Child
 
struct  Stats
 
struct  Timer
 
struct  TrafficGauges
 

Public Types

enum  Promote { Promote::automatic, Promote::never, Promote::always }
 
using PeerSequence = std::vector< std::shared_ptr< Peer > >
 

Public Member Functions

 OverlayImpl (Application &app, Setup const &setup, ServerHandler &serverHandler, Resource::Manager &resourceManager, Resolver &resolver, boost::asio::io_service &io_service, 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 remote_endpoint) override
 Conditionally accept an incoming HTTP request. More...
 
void connect (beast::IP::Endpoint const &remote_endpoint) override
 Establish a peer connection to the specified endpoint. More...
 
int limit () override
 Returns the maximum number of peers we are configured to allow. More...
 
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 Ripple protocol. More...
 
Json::Value json () override
 Return diagnostics on the status of all peers. More...
 
PeerSequence getActivePeers () const override
 Returns a sequence representing the current list of peers. More...
 
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. More...
 
void checkTracking (std::uint32_t) override
 Calls the checkTracking function on each peer. More...
 
std::shared_ptr< PeerfindPeerByShortID (Peer::id_t const &id) const override
 Returns the peer with the matching short id, or null. More...
 
std::shared_ptr< PeerfindPeerByPublicKey (PublicKey const &pubKey) override
 Returns the peer with the matching public key, or null. More...
 
void broadcast (protocol::TMProposeSet &m) override
 Broadcast a proposal. More...
 
void broadcast (protocol::TMValidation &m) override
 Broadcast a validation. More...
 
std::set< Peer::id_trelay (protocol::TMProposeSet &m, uint256 const &uid, PublicKey const &validator) override
 Relay a proposal. More...
 
std::set< Peer::id_trelay (protocol::TMValidation &m, uint256 const &uid, PublicKey const &validator) override
 Relay a validation. More...
 
void relay (uint256 const &, protocol::TMTransaction &m, std::set< Peer::id_t > const &skip) override
 Relay a transaction. More...
 
std::shared_ptr< MessagegetManifestsMessage ()
 
void add_active (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. More...
 
void onPeerDeactivate (Peer::id_t id)
 
template<class UnaryFunc >
void for_each (UnaryFunc &&f) const
 
void onManifests (std::shared_ptr< protocol::TMManifests > const &m, std::shared_ptr< PeerImp > const &from)
 
void reportTraffic (TrafficCount::category cat, bool isInbound, int bytes)
 
void incJqTransOverflow () override
 Increment and retrieve counter for transaction job queue overflows. More...
 
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. More...
 
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. More...
 
Json::Value crawlShards (bool includePublicKey, std::uint32_t relays) override
 Returns information reported to the crawl shard RPC command. More...
 
void endOfPeerChain (std::uint32_t id)
 Called when the reply from the last peer in a peer chain is received. More...
 
void updateSlotAndSquelch (uint256 const &key, PublicKey const &validator, std::set< Peer::id_t > &&peers, protocol::MessageType type)
 Updates message count for validator/peer. More...
 
void updateSlotAndSquelch (uint256 const &key, PublicKey const &validator, Peer::id_t peer, protocol::MessageType type)
 Overload to reduce allocation in case of single peer. More...
 
void deletePeer (Peer::id_t id)
 Called when the peer is deleted. More...
 
Json::Value txMetrics () const override
 Returns tx reduce-relay metrics. More...
 
template<typename... Args>
void addTxMetrics (Args... args)
 Add tx reduce-relay metrics. More...
 
template<class Function >
void foreach (Function f) const
 Visit every active peer. More...
 
std::string const & name () const
 Returns the name of this source. More...
 
void add (Source &source)
 Add a child source. More...
 
template<class Derived >
Derived * add (Derived *child)
 Add a child source by pointer. More...
 
void remove (Source &child)
 Remove a child source from this Source. More...
 
void removeAll ()
 Remove all child sources from this Source. More...
 
void write_one (PropertyStream &stream)
 Write only this Source to the stream. More...
 
void write (PropertyStream &stream)
 write this source and all its children recursively to the stream. More...
 
void write (PropertyStream &stream, std::string const &path)
 Parse the path and write the corresponding Source and optional children. More...
 
std::pair< Source *, bool > find (std::string path)
 Parse the dot-delimited Source path and return the result. More...
 
Sourcefind_one_deep (std::string const &name)
 
PropertyStream::Source * find_path (std::string path)
 
PropertyStream::Source * find_one (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 is_upgrade (boost::beast::http::header< true, Fields > const &req)
 
template<class Fields >
static bool is_upgrade (boost::beast::http::header< false, Fields > const &req)
 
static std::string makePrefix (std::uint32_t id)
 
static bool peel_leading_slash (std::string *path)
 
static bool peel_trailing_slashstar (std::string *path)
 
static std::string peel_name (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. More...
 
void unsquelch (PublicKey const &validator, Peer::id_t id) const override
 Unsquelch handler. More...
 
std::shared_ptr< WritermakeRedirectResponse (std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address)
 
std::shared_ptr< WritermakeErrorResponse (std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type const &request, address_type remote_address, std::string msg)
 
bool processCrawl (http_request_type const &req, Handoff &handoff)
 Handles crawl requests. More...
 
bool processValidatorList (http_request_type const &req, Handoff &handoff)
 Handles validator list requests. More...
 
bool processHealth (http_request_type const &req, Handoff &handoff)
 Handles health requests. More...
 
bool processRequest (http_request_type const &req, Handoff &handoff)
 Handles non-peer protocol requests. More...
 
Json::Value getOverlayInfo ()
 Returns information about peers on the overlay network. More...
 
Json::Value getServerInfo ()
 Returns information about the local server. More...
 
Json::Value getServerCounts ()
 Returns information about the local server's performance counters. More...
 
Json::Value getUnlInfo ()
 Returns information about the local server's UNL. More...
 
void onWrite (beast::PropertyStream::Map &stream) override
 Subclass override. More...
 
void remove (Child &child)
 
void stopChildren ()
 
void autoConnect ()
 
void sendEndpoints ()
 
void sendTxQueue ()
 Send once a second transactions' hashes aggregated by peers. More...
 
void deleteIdlePeers ()
 Check if peers stopped relaying messages and if slots stopped receiving messages from the validator. More...
 
void collect_metrics ()
 

Private Attributes

Applicationapp_
 
boost::asio::io_service & io_service_
 
std::optional< boost::asio::io_service::work > work_
 
boost::asio::io_service::strand 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_
 
const beast::Journal journal_
 
ServerHandlerserverHandler_
 
Resource::Managerm_resourceManager
 
std::unique_ptr< PeerFinder::Managerm_peerFinder
 
TrafficCount m_traffic
 
hash_map< std::shared_ptr< PeerFinder::Slot >, std::weak_ptr< PeerImp > > m_peers
 
hash_map< Peer::id_t, std::weak_ptr< PeerImp > > ids_
 
Resolverm_resolver
 
std::atomic< Peer::id_tnext_id_
 
int timer_count_
 
std::atomic< uint64_t > jqTransOverflow_ {0}
 
std::atomic< uint64_t > peerDisconnects_ {0}
 
std::atomic< uint64_t > peerDisconnectsCharges_ {0}
 
std::mutex csMutex_
 
std::condition_variable csCV_
 
std::set< std::uint32_tcsIDs_
 
reduce_relay::Slots< UptimeClockslots_
 
metrics::TxMetrics txMetrics_
 
std::shared_ptr< MessagemanifestMessage_
 
std::optional< std::uint32_tmanifestListSeq_
 
std::mutex manifestLock_
 
Stats m_stats
 
std::mutex m_statsMutex
 
const std::string m_name
 
std::recursive_mutex lock_
 
Item item_
 
Sourceparent_
 
List< Item > children_
 

Detailed Description

Definition at line 58 of file OverlayImpl.h.

Member Typedef Documentation

◆ clock_type

Definition at line 76 of file OverlayImpl.h.

◆ socket_type

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

Definition at line 77 of file OverlayImpl.h.

◆ address_type

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

Definition at line 78 of file OverlayImpl.h.

◆ endpoint_type

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

Definition at line 79 of file OverlayImpl.h.

◆ error_code

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

Definition at line 80 of file OverlayImpl.h.

◆ stream_type

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

Definition at line 55 of file Overlay.h.

◆ PeerSequence

Definition at line 79 of file Overlay.h.

Member Enumeration Documentation

◆ Promote

enum ripple::Overlay::Promote
stronginherited
Enumerator
automatic 
never 
always 

Definition at line 65 of file Overlay.h.

Constructor & Destructor Documentation

◆ OverlayImpl() [1/2]

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

Definition at line 117 of file OverlayImpl.cpp.

◆ OverlayImpl() [2/2]

ripple::OverlayImpl::OverlayImpl ( OverlayImpl const &  )
delete

Member Function Documentation

◆ operator=()

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

◆ start()

void ripple::OverlayImpl::start ( )
overridevirtual

Reimplemented from ripple::Overlay.

Definition at line 471 of file OverlayImpl.cpp.

◆ stop()

void ripple::OverlayImpl::stop ( )
overridevirtual

Reimplemented from ripple::Overlay.

Definition at line 552 of file OverlayImpl.cpp.

◆ peerFinder()

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

Definition at line 164 of file OverlayImpl.h.

◆ resourceManager()

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

Definition at line 170 of file OverlayImpl.h.

◆ setup()

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

Definition at line 176 of file OverlayImpl.h.

◆ onHandoff()

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

Conditionally accept an incoming HTTP request.

Implements ripple::Overlay.

Definition at line 163 of file OverlayImpl.cpp.

◆ connect()

void ripple::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 ripple::Overlay.

Definition at line 390 of file OverlayImpl.cpp.

◆ limit()

int ripple::OverlayImpl::limit ( )
overridevirtual

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

Implements ripple::Overlay.

Definition at line 795 of file OverlayImpl.cpp.

◆ size()

std::size_t ripple::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 Ripple protocol.

Implements ripple::Overlay.

Definition at line 788 of file OverlayImpl.cpp.

◆ json()

Json::Value ripple::OverlayImpl::json ( )
overridevirtual

Return diagnostics on the status of all peers.

Implements ripple::Overlay.

Definition at line 922 of file OverlayImpl.cpp.

◆ getActivePeers() [1/2]

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

Returns a sequence representing the current list of peers.

The snapshot is made at the time of the call.

Implements ripple::Overlay.

Definition at line 1144 of file OverlayImpl.cpp.

◆ getActivePeers() [2/2]

Overlay::PeerSequence ripple::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 1157 of file OverlayImpl.cpp.

◆ checkTracking()

void ripple::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 ripple::Overlay.

Definition at line 1190 of file OverlayImpl.cpp.

◆ findPeerByShortID()

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

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

Implements ripple::Overlay.

Definition at line 1197 of file OverlayImpl.cpp.

◆ findPeerByPublicKey()

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

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

Implements ripple::Overlay.

Definition at line 1209 of file OverlayImpl.cpp.

◆ broadcast() [1/2]

void ripple::OverlayImpl::broadcast ( protocol::TMProposeSet &  m)
overridevirtual

Broadcast a proposal.

Implements ripple::Overlay.

Definition at line 1224 of file OverlayImpl.cpp.

◆ broadcast() [2/2]

void ripple::OverlayImpl::broadcast ( protocol::TMValidation &  m)
overridevirtual

Broadcast a validation.

Implements ripple::Overlay.

Definition at line 1250 of file OverlayImpl.cpp.

◆ relay() [1/3]

std::set< Peer::id_t > ripple::OverlayImpl::relay ( protocol::TMProposeSet &  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 ripple::Overlay.

Definition at line 1231 of file OverlayImpl.cpp.

◆ relay() [2/3]

std::set< Peer::id_t > ripple::OverlayImpl::relay ( protocol::TMValidation &  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 ripple::Overlay.

Definition at line 1257 of file OverlayImpl.cpp.

◆ relay() [3/3]

void ripple::OverlayImpl::relay ( uint256 const &  hash,
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 ripple::Overlay.

Definition at line 1306 of file OverlayImpl.cpp.

◆ getManifestsMessage()

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

Definition at line 1276 of file OverlayImpl.cpp.

◆ add_active()

void ripple::OverlayImpl::add_active ( std::shared_ptr< PeerImp > const &  peer)

Definition at line 428 of file OverlayImpl.cpp.

◆ remove() [1/3]

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

Definition at line 462 of file OverlayImpl.cpp.

◆ activate()

void ripple::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 594 of file OverlayImpl.cpp.

◆ onPeerDeactivate()

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

Definition at line 618 of file OverlayImpl.cpp.

◆ for_each()

template<class UnaryFunc >
void ripple::OverlayImpl::for_each ( UnaryFunc &&  f) const

Definition at line 281 of file OverlayImpl.h.

◆ onManifests()

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

Definition at line 625 of file OverlayImpl.cpp.

◆ isPeerUpgrade() [1/2]

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

Definition at line 326 of file OverlayImpl.cpp.

◆ isPeerUpgrade() [2/2]

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

Definition at line 313 of file OverlayImpl.h.

◆ is_upgrade() [1/2]

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

Definition at line 323 of file OverlayImpl.h.

◆ is_upgrade() [2/2]

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

Definition at line 337 of file OverlayImpl.h.

◆ makePrefix()

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

Definition at line 335 of file OverlayImpl.cpp.

◆ reportTraffic()

void ripple::OverlayImpl::reportTraffic ( TrafficCount::category  cat,
bool  isInbound,
int  bytes 
)

Definition at line 678 of file OverlayImpl.cpp.

◆ incJqTransOverflow()

void ripple::OverlayImpl::incJqTransOverflow ( )
overridevirtual

Increment and retrieve counter for transaction job queue overflows.

Implements ripple::Overlay.

Definition at line 354 of file OverlayImpl.h.

◆ getJqTransOverflow()

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

Implements ripple::Overlay.

Definition at line 360 of file OverlayImpl.h.

◆ incPeerDisconnect()

void ripple::OverlayImpl::incPeerDisconnect ( )
overridevirtual

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

Implements ripple::Overlay.

Definition at line 366 of file OverlayImpl.h.

◆ getPeerDisconnect()

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

Implements ripple::Overlay.

Definition at line 372 of file OverlayImpl.h.

◆ incPeerDisconnectCharges()

void ripple::OverlayImpl::incPeerDisconnectCharges ( )
overridevirtual

Implements ripple::Overlay.

Definition at line 378 of file OverlayImpl.h.

◆ getPeerDisconnectCharges()

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

Implements ripple::Overlay.

Definition at line 384 of file OverlayImpl.h.

◆ networkID()

std::optional<std::uint32_t> ripple::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 ripple::Overlay.

Definition at line 390 of file OverlayImpl.h.

◆ crawlShards()

Json::Value ripple::OverlayImpl::crawlShards ( bool  includePublicKey,
std::uint32_t  hops 
)
overridevirtual

Returns information reported to the crawl shard RPC command.

Parameters
includePublicKeyinclude peer public keys in the result.
hopsthe maximum jumps the crawler will attempt. The number of hops achieved is not guaranteed.

Implements ripple::Overlay.

Definition at line 687 of file OverlayImpl.cpp.

◆ endOfPeerChain()

void ripple::OverlayImpl::endOfPeerChain ( std::uint32_t  id)

Called when the reply from the last peer in a peer chain is received.

Parameters
idpeer id that received the shard info.

Definition at line 774 of file OverlayImpl.cpp.

◆ updateSlotAndSquelch() [1/2]

void ripple::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 1484 of file OverlayImpl.cpp.

◆ updateSlotAndSquelch() [2/2]

void ripple::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 1502 of file OverlayImpl.cpp.

◆ deletePeer()

void ripple::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 1517 of file OverlayImpl.cpp.

◆ txMetrics()

Json::Value ripple::OverlayImpl::txMetrics ( ) const
overridevirtual

Returns tx reduce-relay metrics.

Returns
json value of tx reduce-relay metrics

Implements ripple::Overlay.

Definition at line 439 of file OverlayImpl.h.

◆ addTxMetrics()

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

Add tx reduce-relay metrics.

Definition at line 447 of file OverlayImpl.h.

◆ squelch()

void ripple::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 ripple::reduce_relay::SquelchHandler.

Definition at line 1471 of file OverlayImpl.cpp.

◆ unsquelch()

void ripple::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 ripple::reduce_relay::SquelchHandler.

Definition at line 1459 of file OverlayImpl.cpp.

◆ makeRedirectResponse()

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

Definition at line 343 of file OverlayImpl.cpp.

◆ makeErrorResponse()

std::shared_ptr< Writer > ripple::OverlayImpl::makeErrorResponse ( std::shared_ptr< PeerFinder::Slot > const &  slot,
http_request_type const &  request,
address_type  remote_address,
std::string  msg 
)
private

Definition at line 370 of file OverlayImpl.cpp.

◆ processCrawl()

bool ripple::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 933 of file OverlayImpl.cpp.

◆ processValidatorList()

bool ripple::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 valdiator 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 970 of file OverlayImpl.cpp.

◆ processHealth()

bool ripple::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 1038 of file OverlayImpl.cpp.

◆ processRequest()

bool ripple::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 1136 of file OverlayImpl.cpp.

◆ getOverlayInfo()

Json::Value ripple::OverlayImpl::getOverlayInfo ( )
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 801 of file OverlayImpl.cpp.

◆ getServerInfo()

Json::Value ripple::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 857 of file OverlayImpl.cpp.

◆ getServerCounts()

Json::Value ripple::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 885 of file OverlayImpl.cpp.

◆ getUnlInfo()

Json::Value ripple::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 891 of file OverlayImpl.cpp.

◆ onWrite()

void ripple::OverlayImpl::onWrite ( beast::PropertyStream::Map )
overrideprivatevirtual

Subclass override.

The default version does nothing.

Reimplemented from beast::PropertyStream::Source.

Definition at line 569 of file OverlayImpl.cpp.

◆ remove() [2/3]

void ripple::OverlayImpl::remove ( Child child)
private

Definition at line 1369 of file OverlayImpl.cpp.

◆ stopChildren()

void ripple::OverlayImpl::stopChildren ( )
private

Definition at line 1378 of file OverlayImpl.cpp.

◆ autoConnect()

void ripple::OverlayImpl::autoConnect ( )
private

Definition at line 1410 of file OverlayImpl.cpp.

◆ sendEndpoints()

void ripple::OverlayImpl::sendEndpoints ( )
private

Definition at line 1418 of file OverlayImpl.cpp.

◆ sendTxQueue()

void ripple::OverlayImpl::sendTxQueue ( )
private

Send once a second transactions' hashes aggregated by peers.

Definition at line 1436 of file OverlayImpl.cpp.

◆ deleteIdlePeers()

void ripple::OverlayImpl::deleteIdlePeers ( )
private

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

Definition at line 1526 of file OverlayImpl.cpp.

◆ collect_metrics()

void ripple::OverlayImpl::collect_metrics ( )
private

Definition at line 615 of file OverlayImpl.h.

◆ foreach()

template<class Function >
void ripple::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 198 of file Overlay.h.

◆ name()

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

Returns the name of this source.

Definition at line 190 of file beast_PropertyStream.cpp.

◆ add() [1/2]

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

Add a child source.

Definition at line 196 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 360 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 208 of file beast_PropertyStream.cpp.

◆ removeAll()

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

Remove all child sources from this Source.

Definition at line 220 of file beast_PropertyStream.cpp.

◆ write_one()

void beast::PropertyStream::Source::write_one ( PropertyStream stream)
inherited

Write only this Source to the stream.

Definition at line 233 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 240 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 252 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 discendent "parent.grandchild." starts at the parent and prints down to grandchild "parent.grandchild.*" starts at parent, print through grandchild children

Definition at line 266 of file beast_PropertyStream.cpp.

◆ find_one_deep()

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

Definition at line 333 of file beast_PropertyStream.cpp.

◆ find_path()

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

Definition at line 350 of file beast_PropertyStream.cpp.

◆ find_one()

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

Definition at line 368 of file beast_PropertyStream.cpp.

◆ peel_leading_slash()

bool beast::PropertyStream::Source::peel_leading_slash ( std::string path)
staticinherited

Definition at line 286 of file beast_PropertyStream.cpp.

◆ peel_trailing_slashstar()

bool beast::PropertyStream::Source::peel_trailing_slashstar ( std::string path)
staticinherited

Definition at line 297 of file beast_PropertyStream.cpp.

◆ peel_name()

std::string beast::PropertyStream::Source::peel_name ( std::string path)
staticinherited

Definition at line 313 of file beast_PropertyStream.cpp.

Member Data Documentation

◆ app_

Application& ripple::OverlayImpl::app_
private

Definition at line 99 of file OverlayImpl.h.

◆ io_service_

boost::asio::io_service& ripple::OverlayImpl::io_service_
private

Definition at line 100 of file OverlayImpl.h.

◆ work_

std::optional<boost::asio::io_service::work> ripple::OverlayImpl::work_
private

Definition at line 101 of file OverlayImpl.h.

◆ strand_

boost::asio::io_service::strand ripple::OverlayImpl::strand_
private

Definition at line 102 of file OverlayImpl.h.

◆ mutex_

std::recursive_mutex ripple::OverlayImpl::mutex_
mutableprivate

Definition at line 103 of file OverlayImpl.h.

◆ cond_

std::condition_variable_any ripple::OverlayImpl::cond_
private

Definition at line 104 of file OverlayImpl.h.

◆ timer_

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

Definition at line 105 of file OverlayImpl.h.

◆ list_

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

Definition at line 106 of file OverlayImpl.h.

◆ setup_

Setup ripple::OverlayImpl::setup_
private

Definition at line 107 of file OverlayImpl.h.

◆ journal_

const beast::Journal ripple::OverlayImpl::journal_
private

Definition at line 108 of file OverlayImpl.h.

◆ serverHandler_

ServerHandler& ripple::OverlayImpl::serverHandler_
private

Definition at line 109 of file OverlayImpl.h.

◆ m_resourceManager

Resource::Manager& ripple::OverlayImpl::m_resourceManager
private

Definition at line 110 of file OverlayImpl.h.

◆ m_peerFinder

std::unique_ptr<PeerFinder::Manager> ripple::OverlayImpl::m_peerFinder
private

Definition at line 111 of file OverlayImpl.h.

◆ m_traffic

TrafficCount ripple::OverlayImpl::m_traffic
private

Definition at line 112 of file OverlayImpl.h.

◆ m_peers

hash_map<std::shared_ptr<PeerFinder::Slot>, std::weak_ptr<PeerImp> > ripple::OverlayImpl::m_peers
private

Definition at line 113 of file OverlayImpl.h.

◆ ids_

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

Definition at line 114 of file OverlayImpl.h.

◆ m_resolver

Resolver& ripple::OverlayImpl::m_resolver
private

Definition at line 115 of file OverlayImpl.h.

◆ next_id_

std::atomic<Peer::id_t> ripple::OverlayImpl::next_id_
private

Definition at line 116 of file OverlayImpl.h.

◆ timer_count_

int ripple::OverlayImpl::timer_count_
private

Definition at line 117 of file OverlayImpl.h.

◆ jqTransOverflow_

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

Definition at line 118 of file OverlayImpl.h.

◆ peerDisconnects_

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

Definition at line 119 of file OverlayImpl.h.

◆ peerDisconnectsCharges_

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

Definition at line 120 of file OverlayImpl.h.

◆ csMutex_

std::mutex ripple::OverlayImpl::csMutex_
private

Definition at line 123 of file OverlayImpl.h.

◆ csCV_

std::condition_variable ripple::OverlayImpl::csCV_
private

Definition at line 124 of file OverlayImpl.h.

◆ csIDs_

std::set<std::uint32_t> ripple::OverlayImpl::csIDs_
private

Definition at line 126 of file OverlayImpl.h.

◆ slots_

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

Definition at line 128 of file OverlayImpl.h.

◆ txMetrics_

metrics::TxMetrics ripple::OverlayImpl::txMetrics_
private

Definition at line 131 of file OverlayImpl.h.

◆ manifestMessage_

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

Definition at line 134 of file OverlayImpl.h.

◆ manifestListSeq_

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

Definition at line 136 of file OverlayImpl.h.

◆ manifestLock_

std::mutex ripple::OverlayImpl::manifestLock_
private

Definition at line 138 of file OverlayImpl.h.

◆ m_stats

Stats ripple::OverlayImpl::m_stats
private

Definition at line 610 of file OverlayImpl.h.

◆ m_statsMutex

std::mutex ripple::OverlayImpl::m_statsMutex
private

Definition at line 611 of file OverlayImpl.h.

◆ m_name

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

Definition at line 333 of file PropertyStream.h.

◆ lock_

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

Definition at line 334 of file PropertyStream.h.

◆ item_

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

Definition at line 335 of file PropertyStream.h.

◆ parent_

Source* beast::PropertyStream::Source::parent_
privateinherited

Definition at line 336 of file PropertyStream.h.

◆ children_

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

Definition at line 337 of file PropertyStream.h.