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);
110 t_core& get_core(){
return m_core;}
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;
177 boost::circular_buffer<size_t> m_avg_buffer = boost::circular_buffer<size_t>(10);
179 template<
class t_parameter>
virtual double get_avg_block_size()=0
virtual double estimate_one_block_size() noexcept
void handler_response_blocks_now(size_t packet_size)
virtual ~cryptonote_protocol_handler_base()
void handler_request_blocks_history(std::list< crypto::hash > &ids)
cryptonote_protocol_handler_base()
t_cryptonote_protocol_handler(t_core &rcore, nodetool::i_p2p_endpoint< connection_context > *p_net_layout, bool offline=false)
void set_no_sync(bool value)
std::string get_peers_overview() const
bool needs_new_sync_connections() const
const block_queue & get_block_queue() const
t_cryptonote_protocol_handler< t_core > cryptonote_protocol_handler
void set_max_out_peers(unsigned int max)
CORE_SYNC_DATA payload_type
cryptonote_connection_context connection_context
std::list< connection_info > get_connections()
void on_connection_close(cryptonote_connection_context &context)
std::pair< uint32_t, uint32_t > get_next_needed_pruning_stripe() const
#define END_INVOKE_MAP2()
#define HANDLE_NOTIFY_T2(NOTIFY, func)
#define BEGIN_INVOKE_MAP2(owner_type)
#define HANDLE_INVOKE_T2(COMMAND, func)
Holds cryptonote related classes and helpers.
std::string print_connection_context_short(const connection_context_base &ctx)
bool store_t_to_binary(t_struct &str_in, std::string &binary_buff, size_t indent=0)
std::unique_ptr< void, terminate > context
Unique ZMQ context handle, calls zmq_term on destruction.
const GenericPointer< typename T::ValueType > T2 value
unsigned __int64 uint64_t
DISABLE_VS_WARNINGS(4244 4345 4503) using namespace crypto