mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 18:40:39 +08:00
node: improve seeds information
Previously, the seeds information would only consist of the connected NodeIds. Improve on this by adding any disconnected and fetching seeds as well. A seed can either be disconnected, connected, or fetching -- where fetching implies connected. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
@@ -174,21 +174,21 @@ pub fn clone<G: Signer>(
|
||||
}
|
||||
|
||||
// Get seeds. This consults the local routing table only.
|
||||
let seeds = node.seeds(id)?;
|
||||
if seeds.is_empty() {
|
||||
let mut seeds = node.seeds(id)?;
|
||||
if !seeds.has_connections() {
|
||||
return Err(CloneError::NotFound(id));
|
||||
}
|
||||
// Fetch from all seeds.
|
||||
for seed in seeds {
|
||||
for seed in seeds.connected() {
|
||||
let spinner = term::spinner(format!(
|
||||
"Fetching {} from {}..",
|
||||
term::format::tertiary(id),
|
||||
term::format::tertiary(term::format::node(&seed))
|
||||
term::format::tertiary(term::format::node(seed))
|
||||
));
|
||||
|
||||
// TODO: If none of them succeeds, output an error. Otherwise tell the caller
|
||||
// how many succeeded.
|
||||
match node.fetch(id, seed)? {
|
||||
match node.fetch(id, *seed)? {
|
||||
FetchResult::Success { .. } => {
|
||||
spinner.finish();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user