Skip to content

Commit

Permalink
This change limits confirmation requests by the status of the tcp cha…
Browse files Browse the repository at this point in the history
…nnel rather than by a fixed number.
  • Loading branch information
clemahieu committed Apr 19, 2022
1 parent 580c3c1 commit 53dbeca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nano/node/confirmation_solicitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool nano::confirmation_solicitor::add (nano::election const & election_a)
if (!exists || !is_final || different)
{
auto & request_queue (requests[rep.channel]);
if (request_queue.size () < max_channel_requests)
if (!rep.channel->full ())
{
request_queue.emplace_back (election_a.status.winner->hash (), election_a.status.winner->root ());
count += different ? 0 : 1;
Expand Down
10 changes: 10 additions & 0 deletions nano/node/transport/tcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ namespace transport
return nano::transport::transport_type::tcp;
}

virtual bool full () override
{
bool result = true;
if (auto socket_l = socket.lock ())
{
result = socket_l->max ();
}
return result;
}

private:
nano::tcp_endpoint endpoint{ boost::asio::ip::address_v6::any (), 0 };
};
Expand Down
4 changes: 4 additions & 0 deletions nano/node/transport/transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ namespace transport
virtual nano::endpoint get_endpoint () const = 0;
virtual nano::tcp_endpoint get_tcp_endpoint () const = 0;
virtual nano::transport::transport_type get_type () const = 0;
virtual bool full ()
{
return false;
}

std::chrono::steady_clock::time_point get_last_bootstrap_attempt () const
{
Expand Down

0 comments on commit 53dbeca

Please sign in to comment.