Monero
Loading...
Searching...
No Matches
cryptonote::t_cryptonote_protocol_handler< t_core > Class Template Reference

#include <cryptonote_protocol_handler.h>

Inheritance diagram for cryptonote::t_cryptonote_protocol_handler< t_core >:
Collaboration diagram for cryptonote::t_cryptonote_protocol_handler< t_core >:

Public Types

typedef cryptonote_connection_context connection_context
typedef t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
typedef CORE_SYNC_DATA payload_type

Public Member Functions

 t_cryptonote_protocol_handler (t_core &rcore, nodetool::i_p2p_endpoint< connection_context > *p_net_layout, bool offline=false)
bool on_idle ()
bool init (const boost::program_options::variables_map &vm)
bool deinit ()
void set_p2p_endpoint (nodetool::i_p2p_endpoint< connection_context > *p2p)
bool process_payload_sync_data (const CORE_SYNC_DATA &hshd, cryptonote_connection_context &context, bool is_inital)
bool get_payload_sync_data (epee::byte_slice &data)
bool get_payload_sync_data (CORE_SYNC_DATA &hshd)
bool on_callback (cryptonote_connection_context &context)
t_core & get_core ()
virtual bool is_synchronized () const final
void log_connections ()
std::list< connection_infoget_connections ()
const block_queueget_block_queue () const
void stop ()
void on_connection_close (cryptonote_connection_context &context)
void set_max_out_peers (epee::net_utils::zone zone, unsigned int max)
unsigned int get_max_out_peers (epee::net_utils::zone zone) const
bool no_sync () const
void set_no_sync (bool value)
std::string get_peers_overview () const
std::pair< uint32_t, uint32_tget_next_needed_pruning_stripe () const
bool needs_new_sync_connections (epee::net_utils::zone zone) const
bool is_busy_syncing ()

Private Member Functions

int handle_notify_new_block (int command, NOTIFY_NEW_BLOCK::request &arg, cryptonote_connection_context &context)
int handle_notify_new_transactions (int command, NOTIFY_NEW_TRANSACTIONS::request &arg, cryptonote_connection_context &context)
int handle_request_get_objects (int command, NOTIFY_REQUEST_GET_OBJECTS::request &arg, cryptonote_connection_context &context)
int handle_response_get_objects (int command, NOTIFY_RESPONSE_GET_OBJECTS::request &arg, cryptonote_connection_context &context)
int handle_request_chain (int command, NOTIFY_REQUEST_CHAIN::request &arg, cryptonote_connection_context &context)
int handle_response_chain_entry (int command, NOTIFY_RESPONSE_CHAIN_ENTRY::request &arg, cryptonote_connection_context &context)
int handle_notify_new_fluffy_block (int command, NOTIFY_NEW_FLUFFY_BLOCK::request &arg, cryptonote_connection_context &context)
int handle_request_fluffy_missing_tx (int command, NOTIFY_REQUEST_FLUFFY_MISSING_TX::request &arg, cryptonote_connection_context &context)
int handle_notify_get_txpool_complement (int command, NOTIFY_GET_TXPOOL_COMPLEMENT::request &arg, cryptonote_connection_context &context)
virtual bool relay_block (NOTIFY_NEW_FLUFFY_BLOCK::request &arg, cryptonote_connection_context &exclude_context)
virtual bool relay_transactions (NOTIFY_NEW_TRANSACTIONS::request &arg, const boost::uuids::uuid &source, epee::net_utils::zone zone, relay_method tx_relay)
bool should_drop_connection (cryptonote_connection_context &context, uint32_t next_stripe)
bool request_missing_objects (cryptonote_connection_context &context, bool check_having_blocks, bool force_next_span=false)
size_t get_synchronizing_connections_count ()
bool on_connection_synchronized ()
bool should_download_next_span (cryptonote_connection_context &context, bool standby)
bool should_ask_for_pruned_data (cryptonote_connection_context &context, uint64_t first_block_height, uint64_t nblocks, bool check_block_weights) const
void drop_connection (cryptonote_connection_context &context, bool add_fail, bool flush_all_spans)
void drop_connection_with_score (cryptonote_connection_context &context, unsigned int score, bool flush_all_spans)
void drop_connection (const boost::uuids::uuid &)
void drop_connections (const epee::net_utils::network_address address)
bool kick_idle_peers ()
bool check_standby_peers ()
bool update_sync_search ()
int try_add_next_blocks (cryptonote_connection_context &context)
void notify_new_stripe (cryptonote_connection_context &context, uint32_t stripe)
size_t skip_unneeded_hashes (cryptonote_connection_context &context, bool check_block_queue) const
bool request_txpool_complement (cryptonote_connection_context &context)
void hit_score (cryptonote_connection_context &context, int32_t score)
uint64_t get_estimated_remaining_sync_seconds (uint64_t current_blockchain_height, uint64_t target_blockchain_height)
std::string get_periodic_sync_estimate (uint64_t current_blockchain_height, uint64_t target_blockchain_height)
double get_avg_block_size ()
template<class t_parameter>
bool post_notify (typename t_parameter::request &arg, cryptonote_connection_context &context)
Private Member Functions inherited from cryptonote::cryptonote_protocol_handler_base
 cryptonote_protocol_handler_base ()
virtual ~cryptonote_protocol_handler_base ()
void handler_request_blocks_history (std::list< crypto::hash > &ids)
void handler_response_blocks_now (size_t packet_size)
virtual double estimate_one_block_size () noexcept

Private Attributes

t_core & m_core
nodetool::p2p_endpoint_stub< connection_contextm_p2p_stub
nodetool::i_p2p_endpoint< connection_context > * m_p2p
std::atomic< uint32_tm_syncronized_connections_count
std::atomic< bool > m_synchronized
std::atomic< bool > m_stopping
std::atomic< bool > m_no_sync
std::atomic< bool > m_ask_for_txpool_complement
boost::mutex m_sync_lock
block_queue m_block_queue
epee::math_helper::once_a_time_seconds< 8 > m_idle_peer_kicker
epee::math_helper::once_a_time_milliseconds< 100 > m_standby_checker
epee::math_helper::once_a_time_seconds< 101 > m_sync_search_checker
epee::math_helper::once_a_time_seconds< 43 > m_bad_peer_checker
std::unordered_map< epee::net_utils::zone, unsigned int > m_max_out_peers
epee::critical_section m_max_out_peers_lock
tools::PerformanceTimer m_sync_timer
tools::PerformanceTimer m_add_timer
uint64_t m_last_add_end_time
uint64_t m_sync_spans_downloaded
uint64_t m_sync_old_spans_downloaded
uint64_t m_sync_bad_spans_downloaded
uint64_t m_sync_download_chain_size
uint64_t m_sync_download_objects_size
size_t m_block_download_max_size
bool m_sync_pruned_blocks
boost::posix_time::ptime m_sync_start_time
boost::posix_time::ptime m_period_start_time
uint64_t m_sync_start_height
uint64_t m_period_start_height
boost::mutex m_buffer_mutex
boost::circular_buffer< size_t > m_avg_buffer = boost::circular_buffer<size_t>(10)
boost::mutex m_bad_peer_check_lock

Member Typedef Documentation

◆ connection_context

template<class t_core>
typedef cryptonote_connection_context cryptonote::t_cryptonote_protocol_handler< t_core >::connection_context

◆ cryptonote_protocol_handler

template<class t_core>
typedef t_cryptonote_protocol_handler<t_core> cryptonote::t_cryptonote_protocol_handler< t_core >::cryptonote_protocol_handler

◆ payload_type

template<class t_core>
typedef CORE_SYNC_DATA cryptonote::t_cryptonote_protocol_handler< t_core >::payload_type

Constructor & Destructor Documentation

◆ t_cryptonote_protocol_handler()

template<class t_core>
cryptonote::t_cryptonote_protocol_handler< t_core >::t_cryptonote_protocol_handler ( t_core & rcore,
nodetool::i_p2p_endpoint< connection_context > * p_net_layout,
bool offline = false )

Member Function Documentation

◆ check_standby_peers()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::check_standby_peers ( )
private

◆ deinit()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::deinit ( )

◆ drop_connection() [1/2]

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::drop_connection ( const boost::uuids::uuid & id)
private

◆ drop_connection() [2/2]

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::drop_connection ( cryptonote_connection_context & context,
bool add_fail,
bool flush_all_spans )
private

◆ drop_connection_with_score()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::drop_connection_with_score ( cryptonote_connection_context & context,
unsigned int score,
bool flush_all_spans )
private

◆ drop_connections()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::drop_connections ( const epee::net_utils::network_address address)
private

◆ get_avg_block_size()

template<class t_core>
double cryptonote::t_cryptonote_protocol_handler< t_core >::get_avg_block_size ( )
privatevirtual

◆ get_block_queue()

template<class t_core>
const block_queue & cryptonote::t_cryptonote_protocol_handler< t_core >::get_block_queue ( ) const
inline

◆ get_connections()

template<class t_core>
std::list< connection_info > cryptonote::t_cryptonote_protocol_handler< t_core >::get_connections ( )

◆ get_core()

template<class t_core>
t_core & cryptonote::t_cryptonote_protocol_handler< t_core >::get_core ( )
inline

◆ get_estimated_remaining_sync_seconds()

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::get_estimated_remaining_sync_seconds ( uint64_t current_blockchain_height,
uint64_t target_blockchain_height )
private

◆ get_max_out_peers()

template<class t_core>
unsigned int cryptonote::t_cryptonote_protocol_handler< t_core >::get_max_out_peers ( epee::net_utils::zone zone) const
inline

◆ get_next_needed_pruning_stripe()

template<class t_core>
std::pair< uint32_t, uint32_t > cryptonote::t_cryptonote_protocol_handler< t_core >::get_next_needed_pruning_stripe ( ) const

◆ get_payload_sync_data() [1/2]

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::get_payload_sync_data ( CORE_SYNC_DATA & hshd)

◆ get_payload_sync_data() [2/2]

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::get_payload_sync_data ( epee::byte_slice & data)

◆ get_peers_overview()

template<class t_core>
std::string cryptonote::t_cryptonote_protocol_handler< t_core >::get_peers_overview ( ) const

◆ get_periodic_sync_estimate()

template<class t_core>
std::string cryptonote::t_cryptonote_protocol_handler< t_core >::get_periodic_sync_estimate ( uint64_t current_blockchain_height,
uint64_t target_blockchain_height )
private

◆ get_synchronizing_connections_count()

template<class t_core>
size_t cryptonote::t_cryptonote_protocol_handler< t_core >::get_synchronizing_connections_count ( )
private

◆ handle_notify_get_txpool_complement()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_notify_get_txpool_complement ( int command,
NOTIFY_GET_TXPOOL_COMPLEMENT::request & arg,
cryptonote_connection_context & context )
private

◆ handle_notify_new_block()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_notify_new_block ( int command,
NOTIFY_NEW_BLOCK::request & arg,
cryptonote_connection_context & context )
private

◆ handle_notify_new_fluffy_block()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_notify_new_fluffy_block ( int command,
NOTIFY_NEW_FLUFFY_BLOCK::request & arg,
cryptonote_connection_context & context )
private

◆ handle_notify_new_transactions()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_notify_new_transactions ( int command,
NOTIFY_NEW_TRANSACTIONS::request & arg,
cryptonote_connection_context & context )
private

◆ handle_request_chain()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_request_chain ( int command,
NOTIFY_REQUEST_CHAIN::request & arg,
cryptonote_connection_context & context )
private

◆ handle_request_fluffy_missing_tx()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_request_fluffy_missing_tx ( int command,
NOTIFY_REQUEST_FLUFFY_MISSING_TX::request & arg,
cryptonote_connection_context & context )
private

◆ handle_request_get_objects()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_request_get_objects ( int command,
NOTIFY_REQUEST_GET_OBJECTS::request & arg,
cryptonote_connection_context & context )
private

◆ handle_response_chain_entry()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_response_chain_entry ( int command,
NOTIFY_RESPONSE_CHAIN_ENTRY::request & arg,
cryptonote_connection_context & context )
private

◆ handle_response_get_objects()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_response_get_objects ( int command,
NOTIFY_RESPONSE_GET_OBJECTS::request & arg,
cryptonote_connection_context & context )
private

◆ hit_score()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::hit_score ( cryptonote_connection_context & context,
int32_t score )
private

◆ init()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::init ( const boost::program_options::variables_map & vm)

◆ is_busy_syncing()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::is_busy_syncing ( )

◆ is_synchronized()

template<class t_core>
virtual bool cryptonote::t_cryptonote_protocol_handler< t_core >::is_synchronized ( ) const
inlinefinalvirtual

◆ kick_idle_peers()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::kick_idle_peers ( )
private

◆ log_connections()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::log_connections ( )

◆ needs_new_sync_connections()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::needs_new_sync_connections ( epee::net_utils::zone zone) const

◆ no_sync()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::no_sync ( ) const
inline

◆ notify_new_stripe()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::notify_new_stripe ( cryptonote_connection_context & context,
uint32_t stripe )
private

◆ on_callback()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::on_callback ( cryptonote_connection_context & context)

◆ on_connection_close()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::on_connection_close ( cryptonote_connection_context & context)

◆ on_connection_synchronized()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::on_connection_synchronized ( )
private

◆ on_idle()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::on_idle ( )

◆ post_notify()

template<class t_core>
template<class t_parameter>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::post_notify ( typename t_parameter::request & arg,
cryptonote_connection_context & context )
inlineprivate

◆ process_payload_sync_data()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::process_payload_sync_data ( const CORE_SYNC_DATA & hshd,
cryptonote_connection_context & context,
bool is_inital )

◆ relay_block()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::relay_block ( NOTIFY_NEW_FLUFFY_BLOCK::request & arg,
cryptonote_connection_context & exclude_context )
privatevirtual

◆ relay_transactions()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::relay_transactions ( NOTIFY_NEW_TRANSACTIONS::request & arg,
const boost::uuids::uuid & source,
epee::net_utils::zone zone,
relay_method tx_relay )
privatevirtual

◆ request_missing_objects()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::request_missing_objects ( cryptonote_connection_context & context,
bool check_having_blocks,
bool force_next_span = false )
private

◆ request_txpool_complement()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::request_txpool_complement ( cryptonote_connection_context & context)
private

◆ set_max_out_peers()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::set_max_out_peers ( epee::net_utils::zone zone,
unsigned int max )
inline

◆ set_no_sync()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::set_no_sync ( bool value)
inline

◆ set_p2p_endpoint()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::set_p2p_endpoint ( nodetool::i_p2p_endpoint< connection_context > * p2p)

◆ should_ask_for_pruned_data()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::should_ask_for_pruned_data ( cryptonote_connection_context & context,
uint64_t first_block_height,
uint64_t nblocks,
bool check_block_weights ) const
private

◆ should_download_next_span()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::should_download_next_span ( cryptonote_connection_context & context,
bool standby )
private

◆ should_drop_connection()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::should_drop_connection ( cryptonote_connection_context & context,
uint32_t next_stripe )
private

◆ skip_unneeded_hashes()

template<class t_core>
size_t cryptonote::t_cryptonote_protocol_handler< t_core >::skip_unneeded_hashes ( cryptonote_connection_context & context,
bool check_block_queue ) const
private

◆ stop()

template<class t_core>
void cryptonote::t_cryptonote_protocol_handler< t_core >::stop ( )

◆ try_add_next_blocks()

template<class t_core>
int cryptonote::t_cryptonote_protocol_handler< t_core >::try_add_next_blocks ( cryptonote_connection_context & context)
private

◆ update_sync_search()

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::update_sync_search ( )
private

Member Data Documentation

◆ m_add_timer

template<class t_core>
tools::PerformanceTimer cryptonote::t_cryptonote_protocol_handler< t_core >::m_add_timer
private

◆ m_ask_for_txpool_complement

template<class t_core>
std::atomic<bool> cryptonote::t_cryptonote_protocol_handler< t_core >::m_ask_for_txpool_complement
private

◆ m_avg_buffer

template<class t_core>
boost::circular_buffer<size_t> cryptonote::t_cryptonote_protocol_handler< t_core >::m_avg_buffer = boost::circular_buffer<size_t>(10)
private

◆ m_bad_peer_check_lock

template<class t_core>
boost::mutex cryptonote::t_cryptonote_protocol_handler< t_core >::m_bad_peer_check_lock
private

◆ m_bad_peer_checker

template<class t_core>
epee::math_helper::once_a_time_seconds<43> cryptonote::t_cryptonote_protocol_handler< t_core >::m_bad_peer_checker
private

◆ m_block_download_max_size

template<class t_core>
size_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_block_download_max_size
private

◆ m_block_queue

template<class t_core>
block_queue cryptonote::t_cryptonote_protocol_handler< t_core >::m_block_queue
private

◆ m_buffer_mutex

template<class t_core>
boost::mutex cryptonote::t_cryptonote_protocol_handler< t_core >::m_buffer_mutex
private

◆ m_core

template<class t_core>
t_core& cryptonote::t_cryptonote_protocol_handler< t_core >::m_core
private

◆ m_idle_peer_kicker

template<class t_core>
epee::math_helper::once_a_time_seconds<8> cryptonote::t_cryptonote_protocol_handler< t_core >::m_idle_peer_kicker
private

◆ m_last_add_end_time

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_last_add_end_time
private

◆ m_max_out_peers

template<class t_core>
std::unordered_map<epee::net_utils::zone, unsigned int> cryptonote::t_cryptonote_protocol_handler< t_core >::m_max_out_peers
private

◆ m_max_out_peers_lock

template<class t_core>
epee::critical_section cryptonote::t_cryptonote_protocol_handler< t_core >::m_max_out_peers_lock
mutableprivate

◆ m_no_sync

template<class t_core>
std::atomic<bool> cryptonote::t_cryptonote_protocol_handler< t_core >::m_no_sync
private

◆ m_p2p

◆ m_p2p_stub

template<class t_core>
nodetool::p2p_endpoint_stub<connection_context> cryptonote::t_cryptonote_protocol_handler< t_core >::m_p2p_stub
private

◆ m_period_start_height

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_period_start_height
private

◆ m_period_start_time

template<class t_core>
boost::posix_time::ptime cryptonote::t_cryptonote_protocol_handler< t_core >::m_period_start_time
private

◆ m_standby_checker

template<class t_core>
epee::math_helper::once_a_time_milliseconds<100> cryptonote::t_cryptonote_protocol_handler< t_core >::m_standby_checker
private

◆ m_stopping

template<class t_core>
std::atomic<bool> cryptonote::t_cryptonote_protocol_handler< t_core >::m_stopping
private

◆ m_sync_bad_spans_downloaded

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_bad_spans_downloaded
private

◆ m_sync_download_chain_size

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_download_chain_size
private

◆ m_sync_download_objects_size

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_download_objects_size
private

◆ m_sync_lock

template<class t_core>
boost::mutex cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_lock
private

◆ m_sync_old_spans_downloaded

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_old_spans_downloaded
private

◆ m_sync_pruned_blocks

template<class t_core>
bool cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_pruned_blocks
private

◆ m_sync_search_checker

template<class t_core>
epee::math_helper::once_a_time_seconds<101> cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_search_checker
private

◆ m_sync_spans_downloaded

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_spans_downloaded
private

◆ m_sync_start_height

template<class t_core>
uint64_t cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_start_height
private

◆ m_sync_start_time

template<class t_core>
boost::posix_time::ptime cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_start_time
private

◆ m_sync_timer

template<class t_core>
tools::PerformanceTimer cryptonote::t_cryptonote_protocol_handler< t_core >::m_sync_timer
private

◆ m_synchronized

template<class t_core>
std::atomic<bool> cryptonote::t_cryptonote_protocol_handler< t_core >::m_synchronized
private

◆ m_syncronized_connections_count

template<class t_core>
std::atomic<uint32_t> cryptonote::t_cryptonote_protocol_handler< t_core >::m_syncronized_connections_count
private

The documentation for this class was generated from the following files: