seedsync_session: fix deceptive logic on failed()

We should return an error when ALL seed slots have failed, not ANY.

Otherwise this would print a deceptive error message ("Network reseed failed") if
we have e.g. 2 seed slots and one seeds successfully and the other fails.
This commit is contained in:
draoi
2024-08-07 10:37:58 +02:00
parent 03025aad13
commit a5eb9cc5bf

View File

@@ -127,9 +127,10 @@ impl SeedSyncSession {
debug!(target: "net::seedsync_session", "Seed sync session stopped!");
}
/// Returns true if every seed attempt per slot has failed.
pub(crate) async fn failed(&self) -> bool {
let slots = &*self.slots.lock().await;
slots.iter().any(|s| s.failed())
slots.iter().all(|s| s.failed())
}
}