38 #include <boost/program_options/variables_map.hpp>
41 #include "math_helper.h"
42 #include "storages/levin_abstract_invoke2.h"
50 #include <boost/circular_buffer.hpp>
55 #define LOCALHOST_INT 2130706433
56 #define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT 500
61 class cryptonote_protocol_handler_base_pimpl;
64 std::unique_ptr<cryptonote_protocol_handler_base_pimpl>
mI;
76 template<class t_core>
88 HANDLE_NOTIFY_T2(
NOTIFY_NEW_BLOCK, &cryptonote_protocol_handler::handle_notify_new_block)
106 bool get_payload_sync_data(
blobdata& data);
110 t_core& get_core(){
return m_core;}
112 void log_connections();
113 std::list<connection_info> get_connections();
119 std::string get_peers_overview()
const;
120 std::pair<uint32_t, uint32_t> get_next_needed_pruning_stripe()
const;
121 bool needs_new_sync_connections()
const;
138 virtual bool request_validators_list_to_all();
144 size_t get_synchronizing_connections_count();
145 bool on_connection_synchronized();
148 bool kick_idle_peers();
149 bool check_standby_peers();
150 bool update_sync_search();
177 boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
179 template<
class t_parameter>
182 LOG_PRINT_L2(
"[" << epee::net_utils::print_connection_context_short(
context) <<
"] post " <<
typeid(t_parameter).
name() <<
" -->");
184 epee::serialization::store_t_to_binary(arg, blob);
static void init(std::string cache_filename)
Definition: blockchain_blackball.cpp:224
Definition: block_queue.h:49
Definition: cryptonote_protocol_handler.h:62
virtual double get_avg_block_size()=0
virtual double estimate_one_block_size() noexcept
Definition: cryptonote_protocol_handler-base.cpp:83
std::unique_ptr< cryptonote_protocol_handler_base_pimpl > mI
Definition: cryptonote_protocol_handler.h:64
void handler_response_blocks_now(size_t packet_size)
Definition: cryptonote_protocol_handler-base.cpp:104
virtual ~cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:98
void handler_request_blocks_history(std::list< crypto::hash > &ids)
Definition: cryptonote_protocol_handler-base.cpp:101
cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:95
Definition: cryptonote_protocol_handler.h:78
epee::math_helper::once_a_time_seconds< 101 > m_sync_search_checker
Definition: cryptonote_protocol_handler.h:167
uint64_t m_last_add_end_time
Definition: cryptonote_protocol_handler.h:170
uint64_t m_sync_download_chain_size
Definition: cryptonote_protocol_handler.h:172
std::atomic< bool > m_no_sync
Definition: cryptonote_protocol_handler.h:162
void set_no_sync(bool value)
Definition: cryptonote_protocol_handler.h:118
bool post_notify(typename t_parameter::request &arg, cryptonote_connection_context &context)
Definition: cryptonote_protocol_handler.h:180
std::atomic< unsigned int > m_max_out_peers
Definition: cryptonote_protocol_handler.h:168
boost::mutex m_buffer_mutex
Definition: cryptonote_protocol_handler.h:175
const block_queue & get_block_queue() const
Definition: cryptonote_protocol_handler.h:114
t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
Definition: cryptonote_protocol_handler.h:82
nodetool::i_p2p_endpoint< connection_context > * m_p2p
Definition: cryptonote_protocol_handler.h:158
block_queue m_block_queue
Definition: cryptonote_protocol_handler.h:164
void set_max_out_peers(unsigned int max)
Definition: cryptonote_protocol_handler.h:117
t_core & m_core
Definition: cryptonote_protocol_handler.h:155
CORE_SYNC_DATA payload_type
Definition: cryptonote_protocol_handler.h:83
epee::math_helper::once_a_time_milliseconds< 100 > m_standby_checker
Definition: cryptonote_protocol_handler.h:166
std::atomic< uint32_t > m_syncronized_connections_count
Definition: cryptonote_protocol_handler.h:159
std::atomic< bool > m_stopping
Definition: cryptonote_protocol_handler.h:161
nodetool::p2p_endpoint_stub< connection_context > m_p2p_stub
Definition: cryptonote_protocol_handler.h:157
size_t m_block_download_max_size
Definition: cryptonote_protocol_handler.h:173
boost::mutex m_sync_lock
Definition: cryptonote_protocol_handler.h:163
tools::PerformanceTimer m_add_timer
Definition: cryptonote_protocol_handler.h:169
cryptonote_connection_context connection_context
Definition: cryptonote_protocol_handler.h:80
epee::math_helper::once_a_time_seconds< 30 > m_idle_peer_kicker
Definition: cryptonote_protocol_handler.h:165
uint64_t m_sync_bad_spans_downloaded
Definition: cryptonote_protocol_handler.h:171
std::atomic< bool > m_synchronized
Definition: cryptonote_protocol_handler.h:160
bool is_synchronized()
Definition: cryptonote_protocol_handler.h:111
core_stat_info stat_info
Definition: cryptonote_protocol_handler.h:81
PUSH_WARNINGS
Definition: hash-ops.h:54
const char * name
Definition: simplewallet.cpp:400
Definition: unordered_containers_boost_serialization.h:39
const
Definition: build_protob.py:9
Holds cryptonote related classes and helpers.
Definition: db_bdb.cpp:226
std::string blobdata
Definition: blobdatatype.h:39
epee::misc_utils::struct_init< core_stat_info_t > core_stat_info
Definition: cryptonote_stat_info.h:54
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:98
int bool
Definition: stdbool.h:36
Definition: cryptonote_protocol_defs.h:210
Definition: cryptonote_protocol_defs.h:341
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:352
Definition: cryptonote_protocol_defs.h:132
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:145
Definition: cryptonote_protocol_defs.h:270
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:283
Definition: cryptonote_protocol_defs.h:152
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:165
Definition: cryptonote_protocol_defs.h:229
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:240
Definition: cryptonote_protocol_defs.h:290
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:305
Definition: cryptonote_protocol_defs.h:171
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:184
Definition: cryptonote_protocol_defs.h:312
epee::misc_utils::struct_init< response_t > response
Definition: cryptonote_protocol_defs.h:330
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:320
Definition: cryptonote_protocol_defs.h:244
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:263
Definition: cryptonote_protocol_defs.h:188
epee::misc_utils::struct_init< request_t > request
Definition: cryptonote_protocol_defs.h:205
Definition: connection_context.h:42
Definition: cryptonote_protocol_handler_common.h:43
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto