Electroneum
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 >:
Inheritance graph
[legend]
Collaboration diagram for cryptonote::t_cryptonote_protocol_handler< t_core >:
Collaboration graph
[legend]

Public Types

typedef cryptonote_connection_context connection_context
 
typedef core_stat_info stat_info
 
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 (blobdata &data)
 
bool get_payload_sync_data (CORE_SYNC_DATA &hshd)
 
bool get_stat_info (core_stat_info &stat_inf)
 
bool on_callback (cryptonote_connection_context &context)
 
t_core & get_core ()
 
bool is_synchronized ()
 
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 (unsigned int max)
 
void set_no_sync (bool value)
 
std::string get_peers_overview () const
 
std::pair< uint32_t, uint32_t > get_next_needed_pruning_stripe () const
 
bool needs_new_sync_connections () const
 

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)
 
bool handle_request_validators_list (int command, NOTIFY_REQUEST_VALIDATORS_LIST::request &req, NOTIFY_REQUEST_VALIDATORS_LIST::response &res, cryptonote_connection_context &context)
 
int handle_notify_emergency_validators_list (int command, NOTIFY_EMERGENCY_VALIDATORS_LIST::request &arg, cryptonote_connection_context &context)
 
virtual bool relay_block (NOTIFY_NEW_BLOCK::request &arg, cryptonote_connection_context &exclude_context)
 
virtual bool relay_transactions (NOTIFY_NEW_TRANSACTIONS::request &arg, cryptonote_connection_context &exclude_context)
 
virtual bool request_validators_list (cryptonote_connection_context &context)
 
virtual bool request_validators_list_to_all ()
 
virtual bool relay_emergency_validator_list (NOTIFY_EMERGENCY_VALIDATORS_LIST::request &arg, cryptonote_connection_context &exclude_context)
 
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)
 
void drop_connection (cryptonote_connection_context &context, bool add_fail, bool flush_all_spans)
 
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)
 
void skip_unneeded_hashes (cryptonote_connection_context &context, bool check_block_queue) const
 
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_t > m_syncronized_connections_count
 
std::atomic< boolm_synchronized
 
std::atomic< boolm_stopping
 
std::atomic< boolm_no_sync
 
boost::mutex m_sync_lock
 
block_queue m_block_queue
 
epee::math_helper::once_a_time_seconds< 30 > 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
 
std::atomic< unsigned int > m_max_out_peers
 
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
 
boost::mutex m_buffer_mutex
 
boost::circular_buffer< size_t > m_avg_buffer = boost::circular_buffer<size_t>(10)
 

Member Typedef Documentation

◆ connection_context

◆ cryptonote_protocol_handler

◆ payload_type

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

◆ stat_info

template<class t_core >
typedef core_stat_info cryptonote::t_cryptonote_protocol_handler< t_core >::stat_info

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()

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

◆ 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_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

◆ get_payload_sync_data() [1/2]

template<class t_core >
bool cryptonote::t_cryptonote_protocol_handler< t_core >::get_payload_sync_data ( blobdata data)

◆ get_payload_sync_data() [2/2]

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

◆ get_peers_overview()

template<class t_core >
std::string cryptonote::t_cryptonote_protocol_handler< t_core >::get_peers_overview

◆ get_stat_info()

template<class t_core >
bool cryptonote::t_cryptonote_protocol_handler< t_core >::get_stat_info ( core_stat_info stat_inf)

◆ get_synchronizing_connections_count()

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

◆ handle_notify_emergency_validators_list()

template<class t_core >
int cryptonote::t_cryptonote_protocol_handler< t_core >::handle_notify_emergency_validators_list ( int  command,
NOTIFY_EMERGENCY_VALIDATORS_LIST::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_request_validators_list()

template<class t_core >
bool cryptonote::t_cryptonote_protocol_handler< t_core >::handle_request_validators_list ( int  command,
NOTIFY_REQUEST_VALIDATORS_LIST::request req,
NOTIFY_REQUEST_VALIDATORS_LIST::response res,
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

◆ init()

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

◆ is_synchronized()

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

◆ 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

◆ 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_BLOCK::request arg,
cryptonote_connection_context exclude_context 
)
privatevirtual

◆ relay_emergency_validator_list()

template<class t_core >
bool cryptonote::t_cryptonote_protocol_handler< t_core >::relay_emergency_validator_list ( NOTIFY_EMERGENCY_VALIDATORS_LIST::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,
cryptonote_connection_context exclude_context 
)
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_validators_list()

template<class t_core >
bool cryptonote::t_cryptonote_protocol_handler< t_core >::request_validators_list ( cryptonote_connection_context context)
privatevirtual

◆ request_validators_list_to_all()

template<class t_core >
bool cryptonote::t_cryptonote_protocol_handler< t_core >::request_validators_list_to_all
privatevirtual

◆ set_max_out_peers()

template<class t_core >
void cryptonote::t_cryptonote_protocol_handler< t_core >::set_max_out_peers ( 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_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 >
void 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_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_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<30> 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::atomic<unsigned int> cryptonote::t_cryptonote_protocol_handler< t_core >::m_max_out_peers
private

◆ 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_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_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_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: