Fix a very rare bug where DHT paniced

This commit is contained in:
Igor Katson 2025-06-06 14:51:33 +01:00
parent 559fca8552
commit 963f8167de
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
3 changed files with 14 additions and 30 deletions

View file

@ -971,9 +971,10 @@ impl DhtWorker {
loop {
interval.tick().await;
let mut found = 0;
let now = Instant::now();
for node in self.dht.routing_table.read().iter() {
if matches!(
node.status(),
node.status(now),
NodeStatus::Questionable | NodeStatus::Unknown
) {
found += 1;