diff options
Diffstat (limited to 'src/p2p')
-rw-r--r-- | src/p2p/net_node.h | 1 | ||||
-rw-r--r-- | src/p2p/net_node.inl | 17 | ||||
-rw-r--r-- | src/p2p/net_node_common.h | 5 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 619bad40f..cc6a486d3 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -172,6 +172,7 @@ namespace nodetool virtual void on_connection_close(p2p_connection_context& context); virtual void callback(p2p_connection_context& context); //----------------- i_p2p_endpoint ------------------------------------------------------------- + virtual bool relay_notify_to_list(int command, const std::string& data_buff, const std::list<boost::uuids::uuid> &connections); virtual bool relay_notify_to_all(int command, const std::string& data_buff, const epee::net_utils::connection_context_base& context); virtual bool invoke_command_to_peer(int command, const std::string& req_buff, std::string& resp_buff, const epee::net_utils::connection_context_base& context); virtual bool invoke_notify_to_peer(int command, const std::string& req_buff, const epee::net_utils::connection_context_base& context); diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index b5bfc2979..5efd6da13 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1242,6 +1242,16 @@ namespace nodetool } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> + bool node_server<t_payload_net_handler>::relay_notify_to_list(int command, const std::string& data_buff, const std::list<boost::uuids::uuid> &connections) + { + BOOST_FOREACH(const auto& c_id, connections) + { + m_net_server.get_config_object().notify(command, data_buff, c_id); + } + return true; + } + //----------------------------------------------------------------------------------- + template<class t_payload_net_handler> bool node_server<t_payload_net_handler>::relay_notify_to_all(int command, const std::string& data_buff, const epee::net_utils::connection_context_base& context) { std::list<boost::uuids::uuid> connections; @@ -1251,12 +1261,7 @@ namespace nodetool connections.push_back(cntxt.m_connection_id); return true; }); - - BOOST_FOREACH(const auto& c_id, connections) - { - m_net_server.get_config_object().notify(command, data_buff, c_id); - } - return true; + return relay_notify_to_list(command, data_buff, connections); } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> diff --git a/src/p2p/net_node_common.h b/src/p2p/net_node_common.h index 846c07779..69bee890c 100644 --- a/src/p2p/net_node_common.h +++ b/src/p2p/net_node_common.h @@ -43,6 +43,7 @@ namespace nodetool template<class t_connection_context> struct i_p2p_endpoint { + virtual bool relay_notify_to_list(int command, const std::string& data_buff, const std::list<boost::uuids::uuid>& connections)=0; virtual bool relay_notify_to_all(int command, const std::string& data_buff, const epee::net_utils::connection_context_base& context)=0; virtual bool invoke_command_to_peer(int command, const std::string& req_buff, std::string& resp_buff, const epee::net_utils::connection_context_base& context)=0; virtual bool invoke_notify_to_peer(int command, const std::string& req_buff, const epee::net_utils::connection_context_base& context)=0; @@ -59,6 +60,10 @@ namespace nodetool template<class t_connection_context> struct p2p_endpoint_stub: public i_p2p_endpoint<t_connection_context> { + virtual bool relay_notify_to_list(int command, const std::string& data_buff, const std::list<boost::uuids::uuid>& connections) + { + return false; + } virtual bool relay_notify_to_all(int command, const std::string& data_buff, const epee::net_utils::connection_context_base& context) { return false; |