diff options
Diffstat (limited to 'src/cryptonote_protocol/cryptonote_protocol_handler.h')
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h index 9d8bc43c2..d54687e6a 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.h +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h @@ -38,10 +38,12 @@ #include <string> #include <ctime> +#include "math_helper.h" #include "storages/levin_abstract_invoke2.h" #include "warnings.h" #include "cryptonote_protocol_defs.h" #include "cryptonote_protocol_handler_common.h" +#include "block_queue.h" #include "cryptonote_basic/connection_context.h" #include "cryptonote_basic/cryptonote_stat_info.h" #include "cryptonote_basic/verification_context.h" @@ -107,7 +109,9 @@ namespace cryptonote bool is_synchronized(){return m_synchronized;} void log_connections(); std::list<connection_info> get_connections(); + const block_queue &get_block_queue() const { return m_block_queue; } void stop(); + void on_connection_close(cryptonote_connection_context &context); private: //----------------- commands handlers ---------------------------------------------- int handle_notify_new_block(int command, NOTIFY_NEW_BLOCK::request& arg, cryptonote_connection_context& context); @@ -124,18 +128,24 @@ namespace cryptonote virtual bool relay_transactions(NOTIFY_NEW_TRANSACTIONS::request& arg, cryptonote_connection_context& exclude_context); //---------------------------------------------------------------------------------- //bool get_payload_sync_data(HANDSHAKE_DATA::request& hshd, cryptonote_connection_context& context); - bool request_missing_objects(cryptonote_connection_context& context, bool check_having_blocks); + 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) const; + void drop_connection(cryptonote_connection_context &context, bool add_fail, bool flush_all_spans); + bool kick_idle_peers(); + int try_add_next_blocks(cryptonote_connection_context &context); + t_core& m_core; nodetool::p2p_endpoint_stub<connection_context> m_p2p_stub; nodetool::i_p2p_endpoint<connection_context>* m_p2p; std::atomic<uint32_t> m_syncronized_connections_count; std::atomic<bool> m_synchronized; - bool m_one_request = true; std::atomic<bool> m_stopping; - epee::critical_section m_sync_lock; + boost::mutex m_sync_lock; + block_queue m_block_queue; + epee::math_helper::once_a_time_seconds<30> m_idle_peer_kicker; boost::mutex m_buffer_mutex; double get_avg_block_size(); |