fixes
This commit is contained in:
parent
dae2e7c10f
commit
df931a9329
@ -108,18 +108,16 @@ impl RoutingTable {
|
|||||||
out
|
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 = self.inner.read();
|
||||||
let inner = &*inner;
|
let inner = &*inner;
|
||||||
let cur_ts = get_aligned_timestamp();
|
let cur_ts = get_aligned_timestamp();
|
||||||
|
|
||||||
let mut out = String::new();
|
let mut out = String::new();
|
||||||
|
|
||||||
let mut b = 0;
|
|
||||||
let mut cnt = 0;
|
|
||||||
out += &format!("Entries: {}\n", inner.bucket_entry_count());
|
out += &format!("Entries: {}\n", inner.bucket_entry_count());
|
||||||
|
|
||||||
for ck in &VALID_CRYPTO_KINDS {
|
for ck in &VALID_CRYPTO_KINDS {
|
||||||
|
let mut b = 0;
|
||||||
let blen = inner.buckets[ck].len();
|
let blen = inner.buckets[ck].len();
|
||||||
while b < blen {
|
while b < blen {
|
||||||
let filtered_entries: Vec<(&PublicKey, &Arc<BucketEntry>)> = inner.buckets[ck][b]
|
let filtered_entries: Vec<(&PublicKey, &Arc<BucketEntry>)> = inner.buckets[ck][b]
|
||||||
@ -142,14 +140,6 @@ impl RoutingTable {
|
|||||||
BucketEntryState::Dead => "D",
|
BucketEntryState::Dead => "D",
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
cnt += 1;
|
|
||||||
if cnt >= limit {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if cnt >= limit {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b += 1;
|
b += 1;
|
||||||
@ -174,6 +164,7 @@ impl RoutingTable {
|
|||||||
const COLS: usize = 16;
|
const COLS: usize = 16;
|
||||||
out += "Buckets:\n";
|
out += "Buckets:\n";
|
||||||
for ck in &VALID_CRYPTO_KINDS {
|
for ck in &VALID_CRYPTO_KINDS {
|
||||||
|
out += &format!(" {}:\n", ck);
|
||||||
let rows = inner.buckets[ck].len() / COLS;
|
let rows = inner.buckets[ck].len() / COLS;
|
||||||
let mut r = 0;
|
let mut r = 0;
|
||||||
let mut b = 0;
|
let mut b = 0;
|
||||||
|
@ -360,12 +360,9 @@ impl VeilidAPI {
|
|||||||
let args: Vec<String> = args.split_whitespace().map(|s| s.to_owned()).collect();
|
let args: Vec<String> = args.split_whitespace().map(|s| s.to_owned()).collect();
|
||||||
|
|
||||||
let mut min_state = BucketEntryState::Unreliable;
|
let mut min_state = BucketEntryState::Unreliable;
|
||||||
let mut limit = 20;
|
|
||||||
for arg in args {
|
for arg in args {
|
||||||
if let Some(ms) = get_bucket_entry_state(&arg) {
|
if let Some(ms) = get_bucket_entry_state(&arg) {
|
||||||
min_state = ms;
|
min_state = ms;
|
||||||
} else if let Some(lim) = get_number(&arg) {
|
|
||||||
limit = lim;
|
|
||||||
} else {
|
} else {
|
||||||
apibail_invalid_argument!("debug_entries", "unknown", arg);
|
apibail_invalid_argument!("debug_entries", "unknown", arg);
|
||||||
}
|
}
|
||||||
@ -373,7 +370,7 @@ impl VeilidAPI {
|
|||||||
|
|
||||||
// Dump routing table entries
|
// Dump routing table entries
|
||||||
let routing_table = self.network_manager()?.routing_table();
|
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> {
|
async fn debug_entry(&self, args: String) -> Result<String, VeilidAPIError> {
|
||||||
@ -881,7 +878,7 @@ impl VeilidAPI {
|
|||||||
help
|
help
|
||||||
buckets [dead|reliable]
|
buckets [dead|reliable]
|
||||||
dialinfo
|
dialinfo
|
||||||
entries [dead|reliable] [limit]
|
entries [dead|reliable]
|
||||||
entry <node>
|
entry <node>
|
||||||
nodeinfo
|
nodeinfo
|
||||||
config [key [new value]]
|
config [key [new value]]
|
||||||
|
Loading…
Reference in New Issue
Block a user