mirror of
https://github.com/monero-project/monero.git
synced 2025-05-02 21:24:51 -04:00
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.
This commit is contained in:
parent
ab594cfee9
commit
5be43fcdba
22 changed files with 1463 additions and 134 deletions
|
@ -88,6 +88,8 @@ public:
|
|||
bool request_callback(boost::uuids::uuid connection_id);
|
||||
template<class callback_t>
|
||||
bool foreach_connection(callback_t cb);
|
||||
template<class callback_t>
|
||||
bool for_connection(const boost::uuids::uuid &connection_id, callback_t cb);
|
||||
size_t get_connections_count();
|
||||
|
||||
async_protocol_handler_config():m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE)
|
||||
|
@ -804,6 +806,18 @@ bool async_protocol_handler_config<t_connection_context>::foreach_connection(cal
|
|||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
template<class t_connection_context> template<class callback_t>
|
||||
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, callback_t cb)
|
||||
{
|
||||
CRITICAL_REGION_LOCAL(m_connects_lock);
|
||||
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
|
||||
if (!aph)
|
||||
return false;
|
||||
if(!cb(aph->get_context_ref()))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------
|
||||
template<class t_connection_context>
|
||||
size_t async_protocol_handler_config<t_connection_context>::get_connections_count()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue