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

Classes

class  Metrics
 

Public Types

enum  Tracking { Tracking::diverged, Tracking::unknown, Tracking::converged }
 Whether the peer's view of the ledger converges or diverges from ours. More...
 
using ptr = std::shared_ptr< Peer >
 
using id_t = std::uint32_t
 Uniquely identifies a peer. More...
 

Public Member Functions

 PeerImp (PeerImp const &)=delete
 
PeerImpoperator= (PeerImp const &)=delete
 
 PeerImp (Application &app, id_t id, std::shared_ptr< PeerFinder::Slot > const &slot, http_request_type &&request, PublicKey const &publicKey, ProtocolVersion protocol, Resource::Consumer consumer, std::unique_ptr< stream_type > &&stream_ptr, OverlayImpl &overlay)
 Create an active incoming peer from an established ssl connection. More...
 
template<class Buffers >
 PeerImp (Application &app, std::unique_ptr< stream_type > &&stream_ptr, Buffers const &buffers, std::shared_ptr< PeerFinder::Slot > &&slot, http_response_type &&response, Resource::Consumer usage, PublicKey const &publicKey, ProtocolVersion protocol, id_t id, OverlayImpl &overlay)
 Create outgoing, handshaked peer. More...
 
virtual ~PeerImp ()
 
beast::Journal const & pjournal () const
 
std::shared_ptr< PeerFinder::Slot > const & slot ()
 
virtual void run ()
 
void stop () override
 
void send (std::shared_ptr< Message > const &m) override
 
void sendTxQueue () override
 Send aggregated transactions' hashes. More...
 
void addTxQueue (uint256 const &hash) override
 Add transaction's hash to the transactions' hashes queue. More...
 
void removeTxQueue (uint256 const &hash) override
 Remove transaction's hash from the transactions' hashes queue. More...
 
template<class FwdIt , class = typename std::enable_if_t<std::is_same< typename std::iterator_traits<FwdIt>::value_type, PeerFinder::Endpoint>::value>>
void sendEndpoints (FwdIt first, FwdIt last)
 Send a set of PeerFinder endpoints as a protocol message. More...
 
beast::IP::Endpoint getRemoteAddress () const override
 
void charge (Resource::Charge const &fee) override
 Adjust this peer's load balance based on the type of load imposed. More...
 
Peer::id_t id () const override
 
bool crawl () const
 Returns true if this connection will publicly share its IP address. More...
 
bool cluster () const override
 Returns true if this connection is a member of the cluster. More...
 
void checkTracking (std::uint32_t validationSeq)
 Check if the peer is tracking. More...
 
void checkTracking (std::uint32_t seq1, std::uint32_t seq2)
 
PublicKey const & getNodePublic () const override
 
std::string getVersion () const
 Return the version of rippled that the peer is running, if reported. More...
 
clock_type::duration uptime () const
 
Json::Value json () override
 
bool supportsFeature (ProtocolFeature f) const override
 
std::optional< std::size_tpublisherListSequence (PublicKey const &pubKey) const override
 
void setPublisherListSequence (PublicKey const &pubKey, std::size_t const seq) override
 
uint256 const & getClosedLedgerHash () const override
 
bool hasLedger (uint256 const &hash, std::uint32_t seq) const override
 
void ledgerRange (std::uint32_t &minSeq, std::uint32_t &maxSeq) const override
 
bool hasTxSet (uint256 const &hash) const override
 
void cycleStatus () override
 
bool hasRange (std::uint32_t uMin, std::uint32_t uMax) override
 
int getScore (bool haveItem) const override
 
bool isHighLatency () const override
 
void fail (std::string const &reason)
 
const hash_map< PublicKey, NodeStore::ShardInfogetPeerShardInfos () const
 
bool compressionEnabled () const override
 
bool txReduceRelayEnabled () const override
 
void onMessageUnknown (std::uint16_t type)
 
void onMessageBegin (std::uint16_t type, std::shared_ptr<::google::protobuf::Message > const &m, std::size_t size, std::size_t uncompressed_size, bool isCompressed)
 
void onMessageEnd (std::uint16_t type, std::shared_ptr<::google::protobuf::Message > const &m)
 
void onMessage (std::shared_ptr< protocol::TMManifests > const &m)
 
void onMessage (std::shared_ptr< protocol::TMPing > const &m)
 
void onMessage (std::shared_ptr< protocol::TMCluster > const &m)
 
void onMessage (std::shared_ptr< protocol::TMGetPeerShardInfo > const &m)
 
void onMessage (std::shared_ptr< protocol::TMPeerShardInfo > const &m)
 
void onMessage (std::shared_ptr< protocol::TMGetPeerShardInfoV2 > const &m)
 
void onMessage (std::shared_ptr< protocol::TMPeerShardInfoV2 > const &m)
 
void onMessage (std::shared_ptr< protocol::TMEndpoints > const &m)
 
void onMessage (std::shared_ptr< protocol::TMTransaction > const &m)
 
void onMessage (std::shared_ptr< protocol::TMGetLedger > const &m)
 
void onMessage (std::shared_ptr< protocol::TMLedgerData > const &m)
 
void onMessage (std::shared_ptr< protocol::TMProposeSet > const &m)
 
void onMessage (std::shared_ptr< protocol::TMStatusChange > const &m)
 
void onMessage (std::shared_ptr< protocol::TMHaveTransactionSet > const &m)
 
void onMessage (std::shared_ptr< protocol::TMValidatorList > const &m)
 
void onMessage (std::shared_ptr< protocol::TMValidatorListCollection > const &m)
 
void onMessage (std::shared_ptr< protocol::TMValidation > const &m)
 
void onMessage (std::shared_ptr< protocol::TMGetObjectByHash > const &m)
 
void onMessage (std::shared_ptr< protocol::TMHaveTransactions > const &m)
 
void onMessage (std::shared_ptr< protocol::TMTransactions > const &m)
 
void onMessage (std::shared_ptr< protocol::TMSquelch > const &m)
 
void onMessage (std::shared_ptr< protocol::TMProofPathRequest > const &m)
 
void onMessage (std::shared_ptr< protocol::TMProofPathResponse > const &m)
 
void onMessage (std::shared_ptr< protocol::TMReplayDeltaRequest > const &m)
 
void onMessage (std::shared_ptr< protocol::TMReplayDeltaResponse > const &m)
 
shared_from_this (T... args)
 
weak_from_this (T... args)
 

Private Types

using clock_type = std::chrono::steady_clock
 
using error_code = boost::system::error_code
 
using socket_type = boost::asio::ip::tcp::socket
 
using middle_type = boost::beast::tcp_stream
 
using stream_type = boost::beast::ssl_stream< middle_type >
 
using address_type = boost::asio::ip::address
 
using endpoint_type = boost::asio::ip::tcp::endpoint
 
using waitable_timer = boost::asio::basic_waitable_timer< std::chrono::steady_clock >
 
using Compressed = compression::Compressed
 

Private Member Functions

void close ()
 
void fail (std::string const &name, error_code ec)
 
void gracefulClose ()
 
void setTimer ()
 
void cancelTimer ()
 
void onTimer (boost::system::error_code const &ec)
 
void onShutdown (error_code ec)
 
void doAccept ()
 
std::string name () const
 
std::string domain () const
 
void doProtocolStart ()
 
void onReadMessage (error_code ec, std::size_t bytes_transferred)
 
void onWriteMessage (error_code ec, std::size_t bytes_transferred)
 
void handleTransaction (std::shared_ptr< protocol::TMTransaction > const &m, bool eraseTxQueue)
 Called from onMessage(TMTransaction(s)). More...
 
void handleHaveTransactions (std::shared_ptr< protocol::TMHaveTransactions > const &m)
 Handle protocol message with hashes of transactions that have not been relayed by an upstream node down to its peers - request transactions, which have not been relayed to this peer. More...
 
bool reduceRelayReady ()
 
void addLedger (uint256 const &hash, std::lock_guard< std::mutex > const &lockedRecentLock)
 
void doFetchPack (const std::shared_ptr< protocol::TMGetObjectByHash > &packet)
 
void onValidatorListMessage (std::string const &messageType, std::string const &manifest, std::uint32_t version, std::vector< ValidatorBlobInfo > const &blobs)
 
void doTransactions (std::shared_ptr< protocol::TMGetObjectByHash > const &packet)
 Process peer's request to send missing transactions. More...
 
void checkTransaction (int flags, bool checkSignature, std::shared_ptr< STTx const > const &stx)
 
void checkPropose (bool isTrusted, std::shared_ptr< protocol::TMProposeSet > const &packet, RCLCxPeerPos peerPos)
 
void checkValidation (std::shared_ptr< STValidation > const &val, uint256 const &key, std::shared_ptr< protocol::TMValidation > const &packet)
 
void sendLedgerBase (std::shared_ptr< Ledger const > const &ledger, protocol::TMLedgerData &ledgerData)
 
std::shared_ptr< Ledger const > getLedger (std::shared_ptr< protocol::TMGetLedger > const &m)
 
std::shared_ptr< SHAMap const > getTxSet (std::shared_ptr< protocol::TMGetLedger > const &m) const
 
void processLedgerRequest (std::shared_ptr< protocol::TMGetLedger > const &m)
 

Static Private Member Functions

static std::string makePrefix (id_t id)
 

Private Attributes

Applicationapp_
 
const id_t id_
 
beast::WrappedSink sink_
 
beast::WrappedSink p_sink_
 
const beast::Journal journal_
 
const beast::Journal p_journal_
 
std::unique_ptr< stream_typestream_ptr_
 
socket_typesocket_
 
stream_typestream_
 
boost::asio::strand< boost::asio::executor > strand_
 
waitable_timer timer_
 
const beast::IP::Endpoint remote_address_
 
OverlayImploverlay_
 
const bool inbound_
 
ProtocolVersion protocol_
 
std::atomic< Trackingtracking_
 
clock_type::time_point trackingTime_
 
bool detaching_ = false
 
const PublicKey publicKey_
 
std::string name_
 
boost::shared_mutex nameMutex_
 
LedgerIndex minLedger_ = 0
 
LedgerIndex maxLedger_ = 0
 
uint256 closedLedgerHash_
 
uint256 previousLedgerHash_
 
boost::circular_buffer< uint256recentLedgers_ {128}
 
boost::circular_buffer< uint256recentTxSets_ {128}
 
std::optional< std::chrono::millisecondslatency_
 
std::optional< std::uint32_tlastPingSeq_
 
clock_type::time_point lastPingTime_
 
const clock_type::time_point creationTime_
 
reduce_relay::Squelch< UptimeClocksquelch_
 
std::mutex recentLock_
 
protocol::TMStatusChange last_status_
 
Resource::Consumer usage_
 
Resource::Charge fee_
 
const std::shared_ptr< PeerFinder::Slotslot_
 
boost::beast::multi_buffer read_buffer_
 
http_request_type request_
 
http_response_type response_
 
boost::beast::http::fields const & headers_
 
std::queue< std::shared_ptr< Message > > send_queue_
 
bool gracefulClose_ = false
 
int large_sendq_ = 0
 
std::unique_ptr< LoadEventload_event_
 
hash_map< PublicKey, std::size_tpublisherListSequences_
 
hash_map< PublicKey, NodeStore::ShardInfoshardInfos_
 
std::mutex shardInfoMutex_
 
Compressed compressionEnabled_ = Compressed::Off
 
hash_set< uint256txQueue_
 
bool txReduceRelayEnabled_ = false
 
bool vpReduceRelayEnabled_ = false
 
bool ledgerReplayEnabled_ = false
 
LedgerReplayMsgHandler ledgerReplayMsgHandler_
 
struct {
   Metrics   sent
 
   Metrics   recv
 
metrics_
 

Static Private Attributes

static std::atomic_bool reduceRelayReady_ {false}
 

Friends

class OverlayImpl
 

Detailed Description

Definition at line 52 of file PeerImp.h.

Member Typedef Documentation

◆ clock_type

Definition at line 61 of file PeerImp.h.

◆ error_code

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

Definition at line 62 of file PeerImp.h.

◆ socket_type

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

Definition at line 63 of file PeerImp.h.

◆ middle_type

using ripple::PeerImp::middle_type = boost::beast::tcp_stream
private

Definition at line 64 of file PeerImp.h.

◆ stream_type

using ripple::PeerImp::stream_type = boost::beast::ssl_stream<middle_type>
private

Definition at line 65 of file PeerImp.h.

◆ address_type

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

Definition at line 66 of file PeerImp.h.

◆ endpoint_type

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

Definition at line 67 of file PeerImp.h.

◆ waitable_timer

using ripple::PeerImp::waitable_timer = boost::asio::basic_waitable_timer<std::chrono::steady_clock>
private

Definition at line 69 of file PeerImp.h.

◆ Compressed

Definition at line 70 of file PeerImp.h.

◆ ptr

Definition at line 48 of file ripple/overlay/Peer.h.

◆ id_t

using ripple::Peer::id_t = std::uint32_t
inherited

Uniquely identifies a peer.

This can be stored in tables to find the peer later. Callers can discover if the peer is no longer connected and make adjustments as needed.

Definition at line 55 of file ripple/overlay/Peer.h.

Member Enumeration Documentation

◆ Tracking

Whether the peer's view of the ledger converges or diverges from ours.

Enumerator
diverged 
unknown 
converged 

Definition at line 58 of file PeerImp.h.

Constructor & Destructor Documentation

◆ PeerImp() [1/3]

ripple::PeerImp::PeerImp ( PeerImp const &  )
delete

◆ PeerImp() [2/3]

ripple::PeerImp::PeerImp ( Application app,
id_t  id,
std::shared_ptr< PeerFinder::Slot > const &  slot,
http_request_type &&  request,
PublicKey const &  publicKey,
ProtocolVersion  protocol,
Resource::Consumer  consumer,
std::unique_ptr< stream_type > &&  stream_ptr,
OverlayImpl overlay 
)

Create an active incoming peer from an established ssl connection.

Definition at line 66 of file PeerImp.cpp.

◆ PeerImp() [3/3]

template<class Buffers >
ripple::PeerImp::PeerImp ( Application app,
std::unique_ptr< stream_type > &&  stream_ptr,
Buffers const &  buffers,
std::shared_ptr< PeerFinder::Slot > &&  slot,
http_response_type &&  response,
Resource::Consumer  usage,
PublicKey const &  publicKey,
ProtocolVersion  protocol,
id_t  id,
OverlayImpl overlay 
)

Create outgoing, handshaked peer.

Definition at line 650 of file PeerImp.h.

◆ ~PeerImp()

ripple::PeerImp::~PeerImp ( )
virtual

Definition at line 134 of file PeerImp.cpp.

Member Function Documentation

◆ operator=()

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

◆ pjournal()

beast::Journal const& ripple::PeerImp::pjournal ( ) const

Definition at line 254 of file PeerImp.h.

◆ slot()

std::shared_ptr<PeerFinder::Slot> const& ripple::PeerImp::slot ( )

Definition at line 260 of file PeerImp.h.

◆ run()

void ripple::PeerImp::run ( )
virtual

Reimplemented in ripple::test::tx_reduce_relay_test::PeerTest.

Definition at line 157 of file PeerImp.cpp.

◆ stop()

void ripple::PeerImp::stop ( )
overridevirtual

Implements ripple::OverlayImpl::Child.

Definition at line 215 of file PeerImp.cpp.

◆ send()

void ripple::PeerImp::send ( std::shared_ptr< Message > const &  m)
overridevirtual

Implements ripple::Peer.

Reimplemented in ripple::test::tx_reduce_relay_test::PeerTest.

Definition at line 241 of file PeerImp.cpp.

◆ sendTxQueue()

void ripple::PeerImp::sendTxQueue ( )
overridevirtual

Send aggregated transactions' hashes.

Implements ripple::Peer.

Definition at line 295 of file PeerImp.cpp.

◆ addTxQueue()

void ripple::PeerImp::addTxQueue ( uint256 const &  hash)
overridevirtual

Add transaction's hash to the transactions' hashes queue.

Parameters
hashtransaction's hash

Implements ripple::Peer.

Reimplemented in ripple::test::tx_reduce_relay_test::PeerTest.

Definition at line 314 of file PeerImp.cpp.

◆ removeTxQueue()

void ripple::PeerImp::removeTxQueue ( uint256 const &  hash)
overridevirtual

Remove transaction's hash from the transactions' hashes queue.

Parameters
hashtransaction's hash

Implements ripple::Peer.

Definition at line 331 of file PeerImp.cpp.

◆ sendEndpoints()

template<class FwdIt , class >
void ripple::PeerImp::sendEndpoints ( FwdIt  first,
FwdIt  last 
)

Send a set of PeerFinder endpoints as a protocol message.

Definition at line 723 of file PeerImp.h.

◆ getRemoteAddress()

beast::IP::Endpoint ripple::PeerImp::getRemoteAddress ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 306 of file PeerImp.h.

◆ charge()

void ripple::PeerImp::charge ( Resource::Charge const &  fee)
overridevirtual

Adjust this peer's load balance based on the type of load imposed.

Implements ripple::Peer.

Definition at line 343 of file PeerImp.cpp.

◆ id()

Peer::id_t ripple::PeerImp::id ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 319 of file PeerImp.h.

◆ crawl()

bool ripple::PeerImp::crawl ( ) const

Returns true if this connection will publicly share its IP address.

Definition at line 357 of file PeerImp.cpp.

◆ cluster()

bool ripple::PeerImp::cluster ( ) const
overridevirtual

Returns true if this connection is a member of the cluster.

Implements ripple::Peer.

Definition at line 366 of file PeerImp.cpp.

◆ checkTracking() [1/2]

void ripple::PeerImp::checkTracking ( std::uint32_t  validationSeq)

Check if the peer is tracking.

Parameters
validationSeqThe ledger sequence of a recently-validated ledger

Definition at line 2193 of file PeerImp.cpp.

◆ checkTracking() [2/2]

void ripple::PeerImp::checkTracking ( std::uint32_t  seq1,
std::uint32_t  seq2 
)

Definition at line 2212 of file PeerImp.cpp.

◆ getNodePublic()

PublicKey const& ripple::PeerImp::getNodePublic ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 341 of file PeerImp.h.

◆ getVersion()

std::string ripple::PeerImp::getVersion ( ) const

Return the version of rippled that the peer is running, if reported.

Definition at line 372 of file PeerImp.cpp.

◆ uptime()

clock_type::duration ripple::PeerImp::uptime ( ) const

Definition at line 352 of file PeerImp.h.

◆ json()

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

Implements ripple::Peer.

Definition at line 380 of file PeerImp.cpp.

◆ supportsFeature()

bool ripple::PeerImp::supportsFeature ( ProtocolFeature  f) const
overridevirtual

Implements ripple::Peer.

Definition at line 498 of file PeerImp.cpp.

◆ publisherListSequence()

std::optional<std::size_t> ripple::PeerImp::publisherListSequence ( PublicKey const &  pubKey) const
overridevirtual

Implements ripple::Peer.

Definition at line 364 of file PeerImp.h.

◆ setPublisherListSequence()

void ripple::PeerImp::setPublisherListSequence ( PublicKey const &  pubKey,
std::size_t const  seq 
)
overridevirtual

Implements ripple::Peer.

Definition at line 375 of file PeerImp.h.

◆ getClosedLedgerHash()

uint256 const& ripple::PeerImp::getClosedLedgerHash ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 388 of file PeerImp.h.

◆ hasLedger()

bool ripple::PeerImp::hasLedger ( uint256 const &  hash,
std::uint32_t  seq 
) const
overridevirtual

Implements ripple::Peer.

Definition at line 515 of file PeerImp.cpp.

◆ ledgerRange()

void ripple::PeerImp::ledgerRange ( std::uint32_t minSeq,
std::uint32_t maxSeq 
) const
overridevirtual

Implements ripple::Peer.

Definition at line 541 of file PeerImp.cpp.

◆ hasTxSet()

bool ripple::PeerImp::hasTxSet ( uint256 const &  hash) const
overridevirtual

Implements ripple::Peer.

Definition at line 550 of file PeerImp.cpp.

◆ cycleStatus()

void ripple::PeerImp::cycleStatus ( )
overridevirtual

Implements ripple::Peer.

Definition at line 558 of file PeerImp.cpp.

◆ hasRange()

bool ripple::PeerImp::hasRange ( std::uint32_t  uMin,
std::uint32_t  uMax 
)
overridevirtual

Implements ripple::Peer.

Definition at line 568 of file PeerImp.cpp.

◆ getScore()

int ripple::PeerImp::getScore ( bool  haveItem) const
overridevirtual

Implements ripple::Peer.

Definition at line 3620 of file PeerImp.cpp.

◆ isHighLatency()

bool ripple::PeerImp::isHighLatency ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 3658 of file PeerImp.cpp.

◆ fail() [1/2]

void ripple::PeerImp::fail ( std::string const &  reason)

Definition at line 600 of file PeerImp.cpp.

◆ getPeerShardInfos()

const hash_map< PublicKey, NodeStore::ShardInfo > ripple::PeerImp::getPeerShardInfos ( ) const

Definition at line 632 of file PeerImp.cpp.

◆ compressionEnabled()

bool ripple::PeerImp::compressionEnabled ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 423 of file PeerImp.h.

◆ txReduceRelayEnabled()

bool ripple::PeerImp::txReduceRelayEnabled ( ) const
overridevirtual

Implements ripple::Peer.

Definition at line 429 of file PeerImp.h.

◆ close()

void ripple::PeerImp::close ( )
private

Definition at line 578 of file PeerImp.cpp.

◆ fail() [2/2]

void ripple::PeerImp::fail ( std::string const &  name,
error_code  ec 
)
private

Definition at line 619 of file PeerImp.cpp.

◆ gracefulClose()

void ripple::PeerImp::gracefulClose ( )
private

Definition at line 639 of file PeerImp.cpp.

◆ setTimer()

void ripple::PeerImp::setTimer ( )
private

Definition at line 655 of file PeerImp.cpp.

◆ cancelTimer()

void ripple::PeerImp::cancelTimer ( )
private

Definition at line 673 of file PeerImp.cpp.

◆ makePrefix()

std::string ripple::PeerImp::makePrefix ( id_t  id)
staticprivate

Definition at line 682 of file PeerImp.cpp.

◆ onTimer()

void ripple::PeerImp::onTimer ( boost::system::error_code const &  ec)
private

Definition at line 690 of file PeerImp.cpp.

◆ onShutdown()

void ripple::PeerImp::onShutdown ( error_code  ec)
private

Definition at line 751 of file PeerImp.cpp.

◆ doAccept()

void ripple::PeerImp::doAccept ( )
private

Definition at line 767 of file PeerImp.cpp.

◆ name()

std::string ripple::PeerImp::name ( ) const
private

Definition at line 833 of file PeerImp.cpp.

◆ domain()

std::string ripple::PeerImp::domain ( ) const
private

Definition at line 840 of file PeerImp.cpp.

◆ doProtocolStart()

void ripple::PeerImp::doProtocolStart ( )
private

Definition at line 850 of file PeerImp.cpp.

◆ onReadMessage()

void ripple::PeerImp::onReadMessage ( error_code  ec,
std::size_t  bytes_transferred 
)
private

Definition at line 893 of file PeerImp.cpp.

◆ onWriteMessage()

void ripple::PeerImp::onWriteMessage ( error_code  ec,
std::size_t  bytes_transferred 
)
private

Definition at line 949 of file PeerImp.cpp.

◆ handleTransaction()

void ripple::PeerImp::handleTransaction ( std::shared_ptr< protocol::TMTransaction > const &  m,
bool  eraseTxQueue 
)
private

Called from onMessage(TMTransaction(s)).

Parameters
mTransaction protocol message
eraseTxQueueis true when called from onMessage(TMTransaction) and is false when called from onMessage(TMTransactions). If true then the transaction hash is erased from txQueue_. Don't need to erase from the queue when called from onMessage(TMTransactions) because this message is a response to the missing transactions request and the queue would not have any of these transactions.

Definition at line 1522 of file PeerImp.cpp.

◆ handleHaveTransactions()

void ripple::PeerImp::handleHaveTransactions ( std::shared_ptr< protocol::TMHaveTransactions > const &  m)
private

Handle protocol message with hashes of transactions that have not been relayed by an upstream node down to its peers - request transactions, which have not been relayed to this peer.

Parameters
mprotocol message with transactions' hashes

Definition at line 2815 of file PeerImp.cpp.

◆ reduceRelayReady()

bool ripple::PeerImp::reduceRelayReady ( )
private

Definition at line 3665 of file PeerImp.cpp.

◆ onMessageUnknown()

void ripple::PeerImp::onMessageUnknown ( std::uint16_t  type)

Definition at line 1003 of file PeerImp.cpp.

◆ onMessageBegin()

void ripple::PeerImp::onMessageBegin ( std::uint16_t  type,
std::shared_ptr<::google::protobuf::Message > const &  m,
std::size_t  size,
std::size_t  uncompressed_size,
bool  isCompressed 
)

Definition at line 1009 of file PeerImp.cpp.

◆ onMessageEnd()

void ripple::PeerImp::onMessageEnd ( std::uint16_t  type,
std::shared_ptr<::google::protobuf::Message > const &  m 
)

Definition at line 1043 of file PeerImp.cpp.

◆ onMessage() [1/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMManifests > const &  m)

Definition at line 1052 of file PeerImp.cpp.

◆ onMessage() [2/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMPing > const &  m)

Definition at line 1072 of file PeerImp.cpp.

◆ onMessage() [3/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMCluster > const &  m)

Definition at line 1109 of file PeerImp.cpp.

◆ onMessage() [4/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMGetPeerShardInfo > const &  m)

Definition at line 1181 of file PeerImp.cpp.

◆ onMessage() [5/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMPeerShardInfo > const &  m)

Definition at line 1187 of file PeerImp.cpp.

◆ onMessage() [6/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMGetPeerShardInfoV2 > const &  m)

Definition at line 1193 of file PeerImp.cpp.

◆ onMessage() [7/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMPeerShardInfoV2 > const &  m)

Definition at line 1263 of file PeerImp.cpp.

◆ onMessage() [8/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMEndpoints > const &  m)

Definition at line 1469 of file PeerImp.cpp.

◆ onMessage() [9/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMTransaction > const &  m)

Definition at line 1516 of file PeerImp.cpp.

◆ onMessage() [10/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMGetLedger > const &  m)

Definition at line 1620 of file PeerImp.cpp.

◆ onMessage() [11/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMLedgerData > const &  m)

Definition at line 1814 of file PeerImp.cpp.

◆ onMessage() [12/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMProposeSet > const &  m)

Definition at line 1913 of file PeerImp.cpp.

◆ onMessage() [13/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMStatusChange > const &  m)

Definition at line 2018 of file PeerImp.cpp.

◆ onMessage() [14/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMHaveTransactionSet > const &  m)

Definition at line 2234 of file PeerImp.cpp.

◆ onMessage() [15/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMValidatorList > const &  m)

Definition at line 2456 of file PeerImp.cpp.

◆ onMessage() [16/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMValidatorListCollection > const &  m)

Definition at line 2484 of file PeerImp.cpp.

◆ onMessage() [17/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMValidation > const &  m)

Definition at line 2523 of file PeerImp.cpp.

◆ onMessage() [18/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMGetObjectByHash > const &  m)

Definition at line 2634 of file PeerImp.cpp.

◆ onMessage() [19/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMHaveTransactions > const &  m)

Definition at line 2796 of file PeerImp.cpp.

◆ onMessage() [20/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMTransactions > const &  m)

Definition at line 2865 of file PeerImp.cpp.

◆ onMessage() [21/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMSquelch > const &  m)

Definition at line 2888 of file PeerImp.cpp.

◆ onMessage() [22/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMProofPathRequest > const &  m)

Definition at line 1716 of file PeerImp.cpp.

◆ onMessage() [23/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMProofPathResponse > const &  m)

Definition at line 1750 of file PeerImp.cpp.

◆ onMessage() [24/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMReplayDeltaRequest > const &  m)

Definition at line 1765 of file PeerImp.cpp.

◆ onMessage() [25/25]

void ripple::PeerImp::onMessage ( std::shared_ptr< protocol::TMReplayDeltaResponse > const &  m)

Definition at line 1799 of file PeerImp.cpp.

◆ addLedger()

void ripple::PeerImp::addLedger ( uint256 const &  hash,
std::lock_guard< std::mutex > const &  lockedRecentLock 
)
private

Definition at line 2944 of file PeerImp.cpp.

◆ doFetchPack()

void ripple::PeerImp::doFetchPack ( const std::shared_ptr< protocol::TMGetObjectByHash > &  packet)
private

Definition at line 2960 of file PeerImp.cpp.

◆ onValidatorListMessage()

void ripple::PeerImp::onValidatorListMessage ( std::string const &  messageType,
std::string const &  manifest,
std::uint32_t  version,
std::vector< ValidatorBlobInfo > const &  blobs 
)
private

Definition at line 2260 of file PeerImp.cpp.

◆ doTransactions()

void ripple::PeerImp::doTransactions ( std::shared_ptr< protocol::TMGetObjectByHash > const &  packet)
private

Process peer's request to send missing transactions.

The request is sent in response to TMHaveTransactions.

Parameters
packetprotocol message containing missing transactions' hashes.

Definition at line 2994 of file PeerImp.cpp.

◆ checkTransaction()

void ripple::PeerImp::checkTransaction ( int  flags,
bool  checkSignature,
std::shared_ptr< STTx const > const &  stx 
)
private

Definition at line 3049 of file PeerImp.cpp.

◆ checkPropose()

void ripple::PeerImp::checkPropose ( bool  isTrusted,
std::shared_ptr< protocol::TMProposeSet > const &  packet,
RCLCxPeerPos  peerPos 
)
private

Definition at line 3125 of file PeerImp.cpp.

◆ checkValidation()

void ripple::PeerImp::checkValidation ( std::shared_ptr< STValidation > const &  val,
uint256 const &  key,
std::shared_ptr< protocol::TMValidation > const &  packet 
)
private

Definition at line 3167 of file PeerImp.cpp.

◆ sendLedgerBase()

void ripple::PeerImp::sendLedgerBase ( std::shared_ptr< Ledger const > const &  ledger,
protocol::TMLedgerData &  ledgerData 
)
private

Definition at line 3262 of file PeerImp.cpp.

◆ getLedger()

std::shared_ptr< Ledger const > ripple::PeerImp::getLedger ( std::shared_ptr< protocol::TMGetLedger > const &  m)
private

Definition at line 3302 of file PeerImp.cpp.

◆ getTxSet()

std::shared_ptr< SHAMap const > ripple::PeerImp::getTxSet ( std::shared_ptr< protocol::TMGetLedger > const &  m) const
private

Definition at line 3413 of file PeerImp.cpp.

◆ processLedgerRequest()

void ripple::PeerImp::processLedgerRequest ( std::shared_ptr< protocol::TMGetLedger > const &  m)
private

Definition at line 3448 of file PeerImp.cpp.

Friends And Related Function Documentation

◆ OverlayImpl

friend class OverlayImpl
friend

Definition at line 184 of file PeerImp.h.

Member Data Documentation

◆ app_

Application& ripple::PeerImp::app_
private

Definition at line 72 of file PeerImp.h.

◆ id_

const id_t ripple::PeerImp::id_
private

Definition at line 73 of file PeerImp.h.

◆ sink_

beast::WrappedSink ripple::PeerImp::sink_
private

Definition at line 74 of file PeerImp.h.

◆ p_sink_

beast::WrappedSink ripple::PeerImp::p_sink_
private

Definition at line 75 of file PeerImp.h.

◆ journal_

const beast::Journal ripple::PeerImp::journal_
private

Definition at line 76 of file PeerImp.h.

◆ p_journal_

const beast::Journal ripple::PeerImp::p_journal_
private

Definition at line 77 of file PeerImp.h.

◆ stream_ptr_

std::unique_ptr<stream_type> ripple::PeerImp::stream_ptr_
private

Definition at line 78 of file PeerImp.h.

◆ socket_

socket_type& ripple::PeerImp::socket_
private

Definition at line 79 of file PeerImp.h.

◆ stream_

stream_type& ripple::PeerImp::stream_
private

Definition at line 80 of file PeerImp.h.

◆ strand_

boost::asio::strand<boost::asio::executor> ripple::PeerImp::strand_
private

Definition at line 81 of file PeerImp.h.

◆ timer_

waitable_timer ripple::PeerImp::timer_
private

Definition at line 82 of file PeerImp.h.

◆ remote_address_

const beast::IP::Endpoint ripple::PeerImp::remote_address_
private

Definition at line 86 of file PeerImp.h.

◆ overlay_

OverlayImpl& ripple::PeerImp::overlay_
private

Definition at line 90 of file PeerImp.h.

◆ inbound_

const bool ripple::PeerImp::inbound_
private

Definition at line 91 of file PeerImp.h.

◆ protocol_

ProtocolVersion ripple::PeerImp::protocol_
private

Definition at line 94 of file PeerImp.h.

◆ tracking_

std::atomic<Tracking> ripple::PeerImp::tracking_
private

Definition at line 96 of file PeerImp.h.

◆ trackingTime_

clock_type::time_point ripple::PeerImp::trackingTime_
private

Definition at line 97 of file PeerImp.h.

◆ detaching_

bool ripple::PeerImp::detaching_ = false
private

Definition at line 98 of file PeerImp.h.

◆ publicKey_

const PublicKey ripple::PeerImp::publicKey_
private

Definition at line 100 of file PeerImp.h.

◆ name_

std::string ripple::PeerImp::name_
private

Definition at line 101 of file PeerImp.h.

◆ nameMutex_

boost::shared_mutex ripple::PeerImp::nameMutex_
mutableprivate

Definition at line 102 of file PeerImp.h.

◆ minLedger_

LedgerIndex ripple::PeerImp::minLedger_ = 0
private

Definition at line 106 of file PeerImp.h.

◆ maxLedger_

LedgerIndex ripple::PeerImp::maxLedger_ = 0
private

Definition at line 107 of file PeerImp.h.

◆ closedLedgerHash_

uint256 ripple::PeerImp::closedLedgerHash_
private

Definition at line 108 of file PeerImp.h.

◆ previousLedgerHash_

uint256 ripple::PeerImp::previousLedgerHash_
private

Definition at line 109 of file PeerImp.h.

◆ recentLedgers_

boost::circular_buffer<uint256> ripple::PeerImp::recentLedgers_ {128}
private

Definition at line 111 of file PeerImp.h.

◆ recentTxSets_

boost::circular_buffer<uint256> ripple::PeerImp::recentTxSets_ {128}
private

Definition at line 112 of file PeerImp.h.

◆ latency_

std::optional<std::chrono::milliseconds> ripple::PeerImp::latency_
private

Definition at line 114 of file PeerImp.h.

◆ lastPingSeq_

std::optional<std::uint32_t> ripple::PeerImp::lastPingSeq_
private

Definition at line 115 of file PeerImp.h.

◆ lastPingTime_

clock_type::time_point ripple::PeerImp::lastPingTime_
private

Definition at line 116 of file PeerImp.h.

◆ creationTime_

const clock_type::time_point ripple::PeerImp::creationTime_
private

Definition at line 117 of file PeerImp.h.

◆ squelch_

reduce_relay::Squelch<UptimeClock> ripple::PeerImp::squelch_
private

Definition at line 119 of file PeerImp.h.

◆ reduceRelayReady_

std::atomic_bool ripple::PeerImp::reduceRelayReady_ {false}
staticprivate

Definition at line 120 of file PeerImp.h.

◆ recentLock_

std::mutex ripple::PeerImp::recentLock_
mutableprivate

Definition at line 149 of file PeerImp.h.

◆ last_status_

protocol::TMStatusChange ripple::PeerImp::last_status_
private

Definition at line 150 of file PeerImp.h.

◆ usage_

Resource::Consumer ripple::PeerImp::usage_
private

Definition at line 151 of file PeerImp.h.

◆ fee_

Resource::Charge ripple::PeerImp::fee_
private

Definition at line 152 of file PeerImp.h.

◆ slot_

const std::shared_ptr<PeerFinder::Slot> ripple::PeerImp::slot_
private

Definition at line 153 of file PeerImp.h.

◆ read_buffer_

boost::beast::multi_buffer ripple::PeerImp::read_buffer_
private

Definition at line 154 of file PeerImp.h.

◆ request_

http_request_type ripple::PeerImp::request_
private

Definition at line 155 of file PeerImp.h.

◆ response_

http_response_type ripple::PeerImp::response_
private

Definition at line 156 of file PeerImp.h.

◆ headers_

boost::beast::http::fields const& ripple::PeerImp::headers_
private

Definition at line 157 of file PeerImp.h.

◆ send_queue_

std::queue<std::shared_ptr<Message> > ripple::PeerImp::send_queue_
private

Definition at line 158 of file PeerImp.h.

◆ gracefulClose_

bool ripple::PeerImp::gracefulClose_ = false
private

Definition at line 159 of file PeerImp.h.

◆ large_sendq_

int ripple::PeerImp::large_sendq_ = 0
private

Definition at line 160 of file PeerImp.h.

◆ load_event_

std::unique_ptr<LoadEvent> ripple::PeerImp::load_event_
private

Definition at line 161 of file PeerImp.h.

◆ publisherListSequences_

hash_map<PublicKey, std::size_t> ripple::PeerImp::publisherListSequences_
private

Definition at line 164 of file PeerImp.h.

◆ shardInfos_

hash_map<PublicKey, NodeStore::ShardInfo> ripple::PeerImp::shardInfos_
private

Definition at line 167 of file PeerImp.h.

◆ shardInfoMutex_

std::mutex ripple::PeerImp::shardInfoMutex_
mutableprivate

Definition at line 168 of file PeerImp.h.

◆ compressionEnabled_

Compressed ripple::PeerImp::compressionEnabled_ = Compressed::Off
private

Definition at line 170 of file PeerImp.h.

◆ txQueue_

hash_set<uint256> ripple::PeerImp::txQueue_
private

Definition at line 175 of file PeerImp.h.

◆ txReduceRelayEnabled_

bool ripple::PeerImp::txReduceRelayEnabled_ = false
private

Definition at line 177 of file PeerImp.h.

◆ vpReduceRelayEnabled_

bool ripple::PeerImp::vpReduceRelayEnabled_ = false
private

Definition at line 180 of file PeerImp.h.

◆ ledgerReplayEnabled_

bool ripple::PeerImp::ledgerReplayEnabled_ = false
private

Definition at line 181 of file PeerImp.h.

◆ ledgerReplayMsgHandler_

LedgerReplayMsgHandler ripple::PeerImp::ledgerReplayMsgHandler_
private

Definition at line 182 of file PeerImp.h.

◆ sent

Metrics ripple::PeerImp::sent

Definition at line 215 of file PeerImp.h.

◆ recv

Metrics ripple::PeerImp::recv

Definition at line 216 of file PeerImp.h.

◆ metrics_

struct { ... } ripple::PeerImp::metrics_