aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/cryptonote_protocol_handler.inl
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-07-11 21:48:54 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-08-07 09:33:17 +0100
commitf57ee382b812e0dcd103023135934e601f9582aa (patch)
treefe48194efb3a3cda2d16594802ea807a23d347e3 /src/cryptonote_protocol/cryptonote_protocol_handler.inl
parentcryptonote_protocol: light cleanup (diff)
downloadmonero-f57ee382b812e0dcd103023135934e601f9582aa.tar.xz
cryptonote_protocol: retry stale spans early
Connections can be dropped by the net_node layer, unbeknownst to cryptonote_protocol, which would then not flush any spans scheduled to that connection, which would cause it to be only downloaded again once it becomes the next span (possibly after a small delay if it had been requested less than 5 seconds ago).
Diffstat (limited to '')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index da250714e..9f44a13be 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -1189,6 +1189,14 @@ skip:
{
m_block_queue.mark_last_block(m_core.get_current_blockchain_height() - 1);
+ // flush stale spans
+ std::set<boost::uuids::uuid> live_connections;
+ m_p2p->for_each_connection([&](cryptonote_connection_context& context, nodetool::peerid_type peer_id, uint32_t support_flags)->bool{
+ live_connections.insert(context.m_connection_id);
+ return true;
+ });
+ m_block_queue.flush_stale_spans(live_connections);
+
// if we don't need to get next span, and the block queue is full enough, wait a bit
bool start_from_current_chain = false;
if (!force_next_span)