38 #include <boost/program_options/variables_map.hpp> 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>
101 bool init(const
boost::program_options::variables_map& vm);
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();
159 std::atomic<uint32_t> m_syncronized_connections_count;
160 std::atomic<bool> m_synchronized;
161 std::atomic<bool> m_stopping;
162 std::atomic<bool> m_no_sync;
163 boost::mutex m_sync_lock;
168 std::atomic<unsigned int> m_max_out_peers;
171 uint64_t m_sync_spans_downloaded, m_sync_old_spans_downloaded, m_sync_bad_spans_downloaded;
172 uint64_t m_sync_download_chain_size, m_sync_download_objects_size;
173 size_t m_block_download_max_size;
175 boost::mutex m_buffer_mutex;
176 double get_avg_block_size();
177 boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
179 template<
class t_parameter>
void handler_request_blocks_history(std::list< crypto::hash > &ids)
#define HANDLE_NOTIFY_T2(NOTIFY, func)
bool store_t_to_binary(t_struct &str_in, std::string &binary_buff, size_t indent=0)
virtual double estimate_one_block_size() noexcept
std::string print_connection_context_short(const connection_context_base &ctx)
bool process_payload_sync_data(const CORE_SYNC_DATA &hshd, cryptonote_connection_context &context, bool is_inital)
bool needs_new_sync_connections() const
const block_queue & get_block_queue() const
void set_p2p_endpoint(nodetool::i_p2p_endpoint< connection_context > *p2p)
void set_no_sync(bool value)
cryptonote_connection_context connection_context
virtual ~cryptonote_protocol_handler_base()
void handler_response_blocks_now(size_t packet_size)
virtual double get_avg_block_size()=0
#define BEGIN_INVOKE_MAP2(owner_type)
bool init(const boost::program_options::variables_map &vm)
Holds cryptonote related classes and helpers.
t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
bool on_callback(cryptonote_connection_context &context)
void on_connection_close(cryptonote_connection_context &context)
std::string get_peers_overview() const
bool get_stat_info(core_stat_info &stat_inf)
unsigned __int64 uint64_t
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
#define END_INVOKE_MAP2()
std::pair< uint32_t, uint32_t > get_next_needed_pruning_stripe() const
CORE_SYNC_DATA payload_type
#define HANDLE_INVOKE_T2(COMMAND, func)
std::list< connection_info > get_connections()
void set_max_out_peers(unsigned int max)
const GenericPointer< typename T::ValueType > T2 value
bool get_payload_sync_data(blobdata &data)
t_cryptonote_protocol_handler(t_core &rcore, nodetool::i_p2p_endpoint< connection_context > *p_net_layout, bool offline=false)
cryptonote_protocol_handler_base()
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto