mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
fixes
This commit is contained in:
parent
dae2e7c10f
commit
df931a9329
@ -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<BucketEntry>)> = 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() {
|
||||
|
@ -360,12 +360,9 @@ impl VeilidAPI {
|
||||
let args: Vec<String> = 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<String, VeilidAPIError> {
|
||||
@ -881,7 +878,7 @@ impl VeilidAPI {
|
||||
help
|
||||
buckets [dead|reliable]
|
||||
dialinfo
|
||||
entries [dead|reliable] [limit]
|
||||
entries [dead|reliable]
|
||||
entry <node>
|
||||
nodeinfo
|
||||
config [key [new value]]
|
||||
|
Loading…
Reference in New Issue
Block a user