From d30dcea56b29301164f3a096007de2d1395c40ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Fri, 3 May 2024 11:44:28 +0200 Subject: [PATCH] Dead code `tcp_channels::modify` --- nano/core_test/peer_container.cpp | 8 ++------ nano/node/transport/tcp_channels.cpp | 12 ------------ nano/node/transport/tcp_channels.hpp | 1 - 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/nano/core_test/peer_container.cpp b/nano/core_test/peer_container.cpp index 5418ba98c..44f7993b7 100644 --- a/nano/core_test/peer_container.cpp +++ b/nano/core_test/peer_container.cpp @@ -79,16 +79,12 @@ TEST (peer_container, tcp_channel_cleanup_works) ASSERT_NE (nullptr, channel1); // set the last packet sent for channel1 only to guarantee it contains a value. // it won't be necessarily the same use by the cleanup cutoff time - node1.network.tcp_channels.modify (channel1, [&now] (auto channel) { - channel->set_last_packet_sent (now - std::chrono::seconds (5)); - }); + channel1->set_last_packet_sent (now - std::chrono::seconds (5)); auto channel2 = nano::test::establish_tcp (system, node1, outer_node2->network.endpoint ()); ASSERT_NE (nullptr, channel2); // set the last packet sent for channel2 only to guarantee it contains a value. // it won't be necessarily the same use by the cleanup cutoff time - node1.network.tcp_channels.modify (channel2, [&now] (auto channel) { - channel->set_last_packet_sent (now + std::chrono::seconds (1)); - }); + channel2->set_last_packet_sent (now + std::chrono::seconds (1)); ASSERT_EQ (2, node1.network.size ()); ASSERT_EQ (2, node1.network.tcp_channels.size ()); diff --git a/nano/node/transport/tcp_channels.cpp b/nano/node/transport/tcp_channels.cpp index 7a4128056..2d1f147f0 100644 --- a/nano/node/transport/tcp_channels.cpp +++ b/nano/node/transport/tcp_channels.cpp @@ -417,18 +417,6 @@ void nano::transport::tcp_channels::list (std::deque const & channel_a, std::function const &)> modify_callback_a) -{ - nano::lock_guard lock{ mutex }; - auto existing (channels.get ().find (channel_a->get_tcp_endpoint ())); - if (existing != channels.get ().end ()) - { - channels.get ().modify (existing, [modify_callback = std::move (modify_callback_a)] (channel_entry & wrapper_a) { - modify_callback (wrapper_a.channel); - }); - } -} - void nano::transport::tcp_channels::start_tcp (nano::endpoint const & endpoint) { node.tcp_listener.connect (endpoint.address (), endpoint.port ()); diff --git a/nano/node/transport/tcp_channels.hpp b/nano/node/transport/tcp_channels.hpp index 7afd89fc7..0e18d75e8 100644 --- a/nano/node/transport/tcp_channels.hpp +++ b/nano/node/transport/tcp_channels.hpp @@ -50,7 +50,6 @@ public: bool track_reachout (nano::endpoint const &); void purge (std::chrono::steady_clock::time_point cutoff_deadline); void list (std::deque> &, uint8_t = 0, bool = true); - void modify (std::shared_ptr const &, std::function const &)>); void keepalive (); std::optional sample_keepalive ();