From 5be43fcdbad5ed034b07831473e07f47b7b10947 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 2 Jul 2017 22:41:15 +0100 Subject: 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. --- src/p2p/net_node.h | 1 + src/p2p/net_node.inl | 8 ++++++++ src/p2p/net_node_common.h | 5 +++++ 3 files changed, 14 insertions(+) (limited to 'src/p2p') diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 8798a52e0..2e0243ec9 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -186,6 +186,7 @@ namespace nodetool virtual bool drop_connection(const epee::net_utils::connection_context_base& context); virtual void request_callback(const epee::net_utils::connection_context_base& context); virtual void for_each_connection(std::function f); + virtual bool for_connection(const boost::uuids::uuid&, std::function f); virtual bool add_host_fail(const epee::net_utils::network_address &address); //----------------- i_connection_filter -------------------------------------------------------- virtual bool is_remote_host_allowed(const epee::net_utils::network_address &address); diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index b23090c7d..87d3df457 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -200,6 +200,14 @@ namespace nodetool } //----------------------------------------------------------------------------------- template + bool node_server::for_connection(const boost::uuids::uuid &connection_id, std::function f) + { + return m_net_server.get_config_object().for_connection(connection_id, [&](p2p_connection_context& cntx){ + return f(cntx, cntx.peer_id, cntx.support_flags); + }); + } + //----------------------------------------------------------------------------------- + template bool node_server::is_remote_host_allowed(const epee::net_utils::network_address &address) { CRITICAL_REGION_LOCAL(m_blocked_hosts_lock); diff --git a/src/p2p/net_node_common.h b/src/p2p/net_node_common.h index 42de2655d..26bad7c72 100644 --- a/src/p2p/net_node_common.h +++ b/src/p2p/net_node_common.h @@ -51,6 +51,7 @@ namespace nodetool virtual void request_callback(const epee::net_utils::connection_context_base& context)=0; virtual uint64_t get_connections_count()=0; virtual void for_each_connection(std::function f)=0; + virtual bool for_connection(const boost::uuids::uuid&, std::function f)=0; virtual bool block_host(const epee::net_utils::network_address &address, time_t seconds = 0)=0; virtual bool unblock_host(const epee::net_utils::network_address &address)=0; virtual std::map get_blocked_hosts()=0; @@ -88,6 +89,10 @@ namespace nodetool { } + virtual bool for_connection(const boost::uuids::uuid&, std::function f) + { + return false; + } virtual uint64_t get_connections_count() { -- cgit v1.2.3