37 #include <boost/program_options/variables_map.hpp> 51 #include <boost/circular_buffer.hpp> 56 #define LOCALHOST_INT 2130706433 57 #define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT 100 63 class cryptonote_protocol_handler_base_pimpl;
66 std::unique_ptr<cryptonote_protocol_handler_base_pimpl>
mI;
78 template<class t_core>
106 bool get_payload_sync_data(
epee::byte_slice&
data);
109 t_core& get_core(){
return m_core;}
111 void log_connections();
112 std::list<connection_info> get_connections();
120 const auto it = m_max_out_peers.find(
zone);
121 if (it == m_max_out_peers.end())
131 std::pair<uint32_t, uint32_t> get_next_needed_pruning_stripe()
const;
133 bool is_busy_syncing();
154 size_t get_synchronizing_connections_count();
155 bool on_connection_synchronized();
162 bool kick_idle_peers();
163 bool check_standby_peers();
164 bool update_sync_search();
200 uint64_t get_estimated_remaining_sync_seconds(
uint64_t current_blockchain_height,
uint64_t target_blockchain_height);
205 boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
209 template<
class t_parameter>
nodetool::p2p_endpoint_stub< connection_context > m_p2p_stub
Definition: cryptonote_protocol_handler.h:173
void handler_request_blocks_history(std::list< crypto::hash > &ids)
Definition: cryptonote_protocol_handler-base.cpp:99
uint64_t m_sync_download_objects_size
Definition: cryptonote_protocol_handler.h:191
#define HANDLE_NOTIFY_T2(NOTIFY, func)
Definition: levin_abstract_invoke2.h:259
Definition: block_queue.h:48
virtual double estimate_one_block_size() noexcept
Definition: cryptonote_protocol_handler-base.cpp:81
static int init(int argc, char **argv, struct runtime_vars *v)
Definition: miniupnpd.c:1149
virtual bool is_synchronized() const final
Definition: cryptonote_protocol_handler.h:110
bool m_sync_pruned_blocks
Definition: cryptonote_protocol_handler.h:193
const CharType(& source)[N]
Definition: pointer.h:1147
PUSH_WARNINGS
Definition: hash-ops.h:53
Definition: cryptonote_protocol_defs.h:364
std::string print_connection_context_short(const connection_context_base &ctx)
Definition: net_utils_base.cpp:128
std::unique_ptr< cryptonote_protocol_handler_base_pimpl > mI
Definition: cryptonote_protocol_handler.h:66
bool store_t_to_binary(t_struct &str_in, byte_slice &binary_buff, size_t initial_buffer_size=8192)
Definition: portable_storage_template_helper.h:118
Definition: portable_binary_archive.hpp:29
const block_queue & get_block_queue() const
Definition: cryptonote_protocol_handler.h:113
std::atomic< bool > m_no_sync
Definition: cryptonote_protocol_handler.h:178
::std::string string
Definition: gtest-port.h:1097
Definition: net_utils_base.h:224
void set_no_sync(bool value)
Definition: cryptonote_protocol_handler.h:129
epee::math_helper::once_a_time_seconds< 101 > m_sync_search_checker
Definition: cryptonote_protocol_handler.h:184
cryptonote_connection_context connection_context
Definition: cryptonote_protocol_handler.h:82
std::string data
Definition: base58.cpp:37
std::atomic< uint32_t > m_syncronized_connections_count
Definition: cryptonote_protocol_handler.h:175
uint64_t m_sync_spans_downloaded
Definition: cryptonote_protocol_handler.h:190
bool no_sync() const
Definition: cryptonote_protocol_handler.h:128
virtual ~cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:96
Definition: connection_context.h:43
#define CURRENCY_PROTOCOL_MAX_OBJECT_REQUEST_COUNT
Definition: cryptonote_protocol_handler.h:57
Provides space for levin (p2p) header, so that payload can be sent without copy.
Definition: levin_base.h:131
Definition: cryptonote_protocol_defs.h:289
void handler_response_blocks_now(size_t packet_size)
Definition: cryptonote_protocol_handler-base.cpp:102
virtual double get_avg_block_size()=0
Definition: cryptonote_protocol_defs.h:192
t_core & m_core
Definition: cryptonote_protocol_handler.h:171
tools::PerformanceTimer m_sync_timer
Definition: cryptonote_protocol_handler.h:188
nodetool::i_p2p_endpoint< connection_context > * m_p2p
Definition: cryptonote_protocol_handler.h:174
boost::mutex m_buffer_mutex
Definition: cryptonote_protocol_handler.h:203
boost::mutex m_bad_peer_check_lock
Definition: cryptonote_protocol_handler.h:207
#define BEGIN_INVOKE_MAP2(owner_type)
Definition: levin_abstract_invoke2.h:240
uint64_t m_last_add_end_time
Definition: cryptonote_protocol_handler.h:189
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:44
std::unordered_map< epee::net_utils::zone, unsigned int > m_max_out_peers
Definition: cryptonote_protocol_handler.h:186
block_queue m_block_queue
Definition: cryptonote_protocol_handler.h:181
t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
Definition: cryptonote_protocol_handler.h:83
Definition: cryptonote_protocol_defs.h:230
const char * uuid
Definition: minissdp.c:598
unsigned int uint32_t
Definition: stdint.h:126
#define POP_WARNINGS
Definition: warnings.h:17
Definition: cryptonote_protocol_defs.h:322
Definition: cryptonote_protocol_handler.h:79
const char * zone_to_string(zone value) noexcept
Definition: net_utils_base.cpp:135
std::atomic< bool > m_stopping
Definition: cryptonote_protocol_handler.h:177
unsigned __int64 uint64_t
Definition: stdint.h:136
#define CRITICAL_REGION_LOCAL(x)
Definition: syncobj.h:153
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
Definition: zmq.h:105
Definition: cryptonote_protocol_defs.h:172
bool post_notify(typename t_parameter::request &arg, cryptonote_connection_context &context)
Definition: cryptonote_protocol_handler.h:210
void set_max_out_peers(epee::net_utils::zone zone, unsigned int max)
Definition: cryptonote_protocol_handler.h:116
Definition: misc_language.h:103
Definition: cryptonote_protocol_defs.h:272
#define END_INVOKE_MAP2()
Definition: levin_abstract_invoke2.h:285
relay_method tx_relay
Definition: levin_notify.cpp:549
Definition: cryptonote_protocol_defs.h:250
CORE_SYNC_DATA payload_type
Definition: cryptonote_protocol_handler.h:84
Definition: cryptonote_protocol_handler.h:64
epee::critical_section m_max_out_peers_lock
Definition: cryptonote_protocol_handler.h:187
std::atomic< bool > m_synchronized
Definition: cryptonote_protocol_handler.h:176
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto
randomx_vm * vm
Definition: tests.cpp:20
TODO: (mj-xmr) This will be reduced in an another PR.
Definition: byte_slice.h:39
uint32_t address
Definition: getifaddr.c:269
unsigned int get_max_out_peers(epee::net_utils::zone zone) const
Definition: cryptonote_protocol_handler.h:117
epee::math_helper::once_a_time_seconds< 43 > m_bad_peer_checker
Definition: cryptonote_protocol_handler.h:185
const T & move(const T &t)
Definition: gtest-port.h:1317
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4
Definition: cryptonote_config.h:98
boost::posix_time::ptime m_period_start_time
Definition: cryptonote_protocol_handler.h:197
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
boost::mutex m_sync_lock
Definition: cryptonote_protocol_handler.h:180
int bool
Definition: stdbool.h:35
std::atomic< bool > m_ask_for_txpool_complement
Definition: cryptonote_protocol_handler.h:179
#define P2P_DEFAULT_CONNECTIONS_COUNT
Definition: cryptonote_config.h:139
zone
Definition: enums.h:49
cryptonote_protocol_handler_base()
Definition: cryptonote_protocol_handler-base.cpp:93
relay_method
Methods tracking how a tx was received and relayed.
Definition: enums.h:36
Definition: cryptonote_protocol_defs.h:213
Definition: cryptonote_protocol_defs.h:342
signed int int32_t
Definition: stdint.h:123
const char * name
Definition: options.c:30
epee::math_helper::once_a_time_milliseconds< 100 > m_standby_checker
Definition: cryptonote_protocol_handler.h:183
boost::posix_time::ptime m_sync_start_time
Definition: cryptonote_protocol_handler.h:196
#define const
Definition: ipfrdr.c:80
size_t m_block_download_max_size
Definition: cryptonote_protocol_handler.h:192
uint64_t m_sync_start_height
Definition: cryptonote_protocol_handler.h:198
epee::math_helper::once_a_time_seconds< 8 > m_idle_peer_kicker
Definition: cryptonote_protocol_handler.h:182
uint64_t m_period_start_height
Definition: cryptonote_protocol_handler.h:199
Definition: cryptonote_protocol_handler_common.h:41