Dead code tcp_channels::modify
This commit is contained in:
parent
75bee9463d
commit
d30dcea56b
3 changed files with 2 additions and 19 deletions
|
|
@ -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 ());
|
||||
|
||||
|
|
|
|||
|
|
@ -417,18 +417,6 @@ void nano::transport::tcp_channels::list (std::deque<std::shared_ptr<nano::trans
|
|||
// clang-format on
|
||||
}
|
||||
|
||||
void nano::transport::tcp_channels::modify (std::shared_ptr<nano::transport::tcp_channel> const & channel_a, std::function<void (std::shared_ptr<nano::transport::tcp_channel> const &)> modify_callback_a)
|
||||
{
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
auto existing (channels.get<endpoint_tag> ().find (channel_a->get_tcp_endpoint ()));
|
||||
if (existing != channels.get<endpoint_tag> ().end ())
|
||||
{
|
||||
channels.get<endpoint_tag> ().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 ());
|
||||
|
|
|
|||
|
|
@ -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<std::shared_ptr<nano::transport::channel>> &, uint8_t = 0, bool = true);
|
||||
void modify (std::shared_ptr<nano::transport::tcp_channel> const &, std::function<void (std::shared_ptr<nano::transport::tcp_channel> const &)>);
|
||||
void keepalive ();
|
||||
std::optional<nano::keepalive> sample_keepalive ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue