Skip to content

Commit

Permalink
DEBUG
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Mar 16, 2024
1 parent 1c52c24 commit d027579
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions nano/node/transport/tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ std::unordered_set<std::shared_ptr<nano::transport::channel>> nano::transport::t
{
auto index (nano::random_pool::generate_word32 (0, static_cast<CryptoPP::word32> (peers_size - 1)));

release_assert (index < channels.size ());
auto channel = channels.get<random_access_tag> ()[index].channel;
release_assert (channel != nullptr);
if (!channel->alive ())
{
continue;
Expand Down Expand Up @@ -544,11 +546,15 @@ std::optional<nano::keepalive> nano::transport::tcp_channels::sample_keepalive (
void nano::transport::tcp_channels::list (std::deque<std::shared_ptr<nano::transport::channel>> & deque_a, uint8_t minimum_version_a, bool include_temporary_channels_a)
{
nano::lock_guard<nano::mutex> lock{ mutex };
// clang-format off
nano::transform_if (channels.get<random_access_tag> ().begin (), channels.get<random_access_tag> ().end (), std::back_inserter (deque_a),
[include_temporary_channels_a, minimum_version_a](auto & channel_a) { return channel_a.channel->get_network_version () >= minimum_version_a && (include_temporary_channels_a || !channel_a.channel->temporary); },
[](auto const & channel) { return channel.channel; });
// clang-format on

nano::transform_if (
channels.get<random_access_tag> ().begin (), channels.get<random_access_tag> ().end (), std::back_inserter (deque_a),
[include_temporary_channels_a, minimum_version_a] (auto & channel_a) {
release_assert (channel_a.channel != nullptr);
return channel_a.channel->get_network_version () >= minimum_version_a && (include_temporary_channels_a || !channel_a.channel->temporary); },
[] (auto const & channel) {
return channel.channel;
});
}

void nano::transport::tcp_channels::modify (std::shared_ptr<nano::transport::channel_tcp> const & channel_a, std::function<void (std::shared_ptr<nano::transport::channel_tcp> const &)> modify_callback_a)
Expand Down
4 changes: 2 additions & 2 deletions nano/node/transport/tcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace transport
return nano::transport::transport_type::tcp;
}

virtual bool max (nano::transport::traffic_type traffic_type) override
bool max (nano::transport::traffic_type traffic_type) override
{
bool result = true;
if (auto socket_l = socket.lock ())
Expand All @@ -106,7 +106,7 @@ namespace transport
return result;
}

virtual bool alive () const override
bool alive () const override
{
if (auto socket_l = socket.lock ())
{
Expand Down

0 comments on commit d027579

Please sign in to comment.