Track channel cleanup stats
This commit is contained in:
parent
2c6ed183b1
commit
3d8338763f
2 changed files with 5 additions and 0 deletions
|
|
@ -32,6 +32,7 @@ enum class type
|
|||
tcp,
|
||||
tcp_channels,
|
||||
tcp_channels_rejected,
|
||||
tcp_channels_purge,
|
||||
tcp_listener,
|
||||
tcp_listener_rejected,
|
||||
channel,
|
||||
|
|
@ -286,6 +287,8 @@ enum class detail
|
|||
channel_accepted,
|
||||
channel_rejected,
|
||||
channel_duplicate,
|
||||
idle,
|
||||
outdated,
|
||||
|
||||
// tcp_server
|
||||
handshake,
|
||||
|
|
|
|||
|
|
@ -439,6 +439,7 @@ void nano::transport::tcp_channels::purge (std::chrono::steady_clock::time_point
|
|||
// Remove channels that haven't successfully sent a message within the cutoff time
|
||||
if (auto last = channel->get_last_packet_sent (); last < cutoff_deadline)
|
||||
{
|
||||
node.stats.inc (nano::stat::type::tcp_channels_purge, nano::stat::detail::idle);
|
||||
node.logger.debug (nano::log::type::tcp_channels, "Closing idle channel: {} (idle for {}s)",
|
||||
channel->to_string (),
|
||||
nano::log::seconds_delta (last));
|
||||
|
|
@ -448,6 +449,7 @@ void nano::transport::tcp_channels::purge (std::chrono::steady_clock::time_point
|
|||
// Check if any tcp channels belonging to old protocol versions which may still be alive due to async operations
|
||||
if (channel->get_network_version () < node.network_params.network.protocol_version_min)
|
||||
{
|
||||
node.stats.inc (nano::stat::type::tcp_channels_purge, nano::stat::detail::outdated);
|
||||
node.logger.debug (nano::log::type::tcp_channels, "Closing channel with old protocol version: {}", channel->to_string ());
|
||||
|
||||
return true; // Close
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue