From df931a93294ccd6fd573a4df78666f261180f0de Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 13 Mar 2023 20:59:57 -0400 Subject: [PATCH] fixes --- veilid-core/src/routing_table/debug.rs | 17 ++++------------- veilid-core/src/veilid_api/debug.rs | 7 ++----- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/veilid-core/src/routing_table/debug.rs b/veilid-core/src/routing_table/debug.rs index a3409bb3..6b4772e9 100644 --- a/veilid-core/src/routing_table/debug.rs +++ b/veilid-core/src/routing_table/debug.rs @@ -108,18 +108,16 @@ impl RoutingTable { out } - pub(crate) fn debug_info_entries(&self, limit: usize, min_state: BucketEntryState) -> String { + pub(crate) fn debug_info_entries(&self, min_state: BucketEntryState) -> String { let inner = self.inner.read(); let inner = &*inner; let cur_ts = get_aligned_timestamp(); let mut out = String::new(); - let mut b = 0; - let mut cnt = 0; out += &format!("Entries: {}\n", inner.bucket_entry_count()); - for ck in &VALID_CRYPTO_KINDS { + let mut b = 0; let blen = inner.buckets[ck].len(); while b < blen { let filtered_entries: Vec<(&PublicKey, &Arc)> = inner.buckets[ck][b] @@ -142,14 +140,6 @@ impl RoutingTable { BucketEntryState::Dead => "D", } ); - - cnt += 1; - if cnt >= limit { - break; - } - } - if cnt >= limit { - break; } } b += 1; @@ -174,12 +164,13 @@ impl RoutingTable { const COLS: usize = 16; out += "Buckets:\n"; for ck in &VALID_CRYPTO_KINDS { + out += &format!(" {}:\n", ck); let rows = inner.buckets[ck].len() / COLS; let mut r = 0; let mut b = 0; while r < rows { let mut c = 0; - out += format!(" {:>3}: ", b).as_str(); + out += format!(" {:>3}: ", b).as_str(); while c < COLS { let mut cnt = 0; for e in inner.buckets[ck][b].entries() { diff --git a/veilid-core/src/veilid_api/debug.rs b/veilid-core/src/veilid_api/debug.rs index db5faee7..c744fa3b 100644 --- a/veilid-core/src/veilid_api/debug.rs +++ b/veilid-core/src/veilid_api/debug.rs @@ -360,12 +360,9 @@ impl VeilidAPI { let args: Vec = args.split_whitespace().map(|s| s.to_owned()).collect(); let mut min_state = BucketEntryState::Unreliable; - let mut limit = 20; for arg in args { if let Some(ms) = get_bucket_entry_state(&arg) { min_state = ms; - } else if let Some(lim) = get_number(&arg) { - limit = lim; } else { apibail_invalid_argument!("debug_entries", "unknown", arg); } @@ -373,7 +370,7 @@ impl VeilidAPI { // Dump routing table entries let routing_table = self.network_manager()?.routing_table(); - Ok(routing_table.debug_info_entries(limit, min_state)) + Ok(routing_table.debug_info_entries(min_state)) } async fn debug_entry(&self, args: String) -> Result { @@ -881,7 +878,7 @@ impl VeilidAPI { help buckets [dead|reliable] dialinfo - entries [dead|reliable] [limit] + entries [dead|reliable] entry nodeinfo config [key [new value]]