From a40c338e6f1c8ca8ec8f56f02cdb5a0443e4774c Mon Sep 17 00:00:00 2001 From: Arian Rezazadeh Date: Wed, 18 Sep 2024 21:07:55 +0330 Subject: [PATCH] log remaining clients after cleanup --- forwarder/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forwarder/src/lib.rs b/forwarder/src/lib.rs index 3bc59e4..f280be5 100644 --- a/forwarder/src/lib.rs +++ b/forwarder/src/lib.rs @@ -160,6 +160,7 @@ fn cleanup_thread(peer_manager: Arc>) { /// try cleaning peers that has not been used for about `CLEANUP_INTERVAL` duration. fn try_cleanup(peer_manager: &RwLock) { let mut peers = peer_manager.write(); + let mut used_client_count = 0; for peer in peers.get_all() { let result = peer .used @@ -175,6 +176,9 @@ fn try_cleanup(peer_manager: &RwLock) { let client_addr = peer.get_client_addr(); log::info!("cleaning peer that handled '{client_addr}'"); peers.remove_peer(client_addr, peer.get_token()); + } else { + used_client_count += 1; } } + log::info!("{used_client_count} clients remaining after cleanup"); }