aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/cryptonote_protocol_handler.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-07-02 22:41:15 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-07 09:33:04 +0100
commit5be43fcdbad5ed034b07831473e07f47b7b10947 (patch)
tree260422ebe0f60763ad1d61c610c77805ffa25a72 /src/cryptonote_protocol/cryptonote_protocol_handler.h
parentMerge pull request #2159 (diff)
downloadmonero-5be43fcdbad5ed034b07831473e07f47b7b10947.tar.xz
cryptonote_protocol_handler: sync speedup
A block queue is now placed between block download and block processing. Blocks are now requested only from one peer (unless starved). Includes a new sync_info coommand.
Diffstat (limited to 'src/cryptonote_protocol/cryptonote_protocol_handler.h')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h
index 9d8bc43c2..dcee03f66 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.h
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h
@@ -42,6 +42,7 @@
#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,6 +108,7 @@ 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();
private:
//----------------- commands handlers ----------------------------------------------
@@ -124,18 +126,19 @@ 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;
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;
boost::mutex m_buffer_mutex;
double get_avg_block_size();