Don't report the bootstrap as completed unless it actually succeeds.
(Previously we'd report it as successful even if the inner download task was a failure.)
This commit is contained in:
parent
f15cde80de
commit
8113a8ba12
|
@ -186,7 +186,7 @@ async fn download_attempt<R: Runtime>(
|
|||
pub(crate) async fn download<R: Runtime>(
|
||||
dirmgr: Weak<DirMgr<R>>,
|
||||
mut state: Box<dyn DirState>,
|
||||
mut on_usable: Option<oneshot::Sender<()>>,
|
||||
on_usable: &mut Option<oneshot::Sender<()>>,
|
||||
) -> Result<(Box<dyn DirState>, Option<Error>)> {
|
||||
let runtime = upgrade_weak_ref(&dirmgr)?.runtime.clone();
|
||||
|
||||
|
@ -277,6 +277,9 @@ pub(crate) async fn download<R: Runtime>(
|
|||
}
|
||||
|
||||
// We didn't advance the state, after all the retries.
|
||||
warn!(n_attempts=retry_config.n_attempts(),
|
||||
state=%state.describe(),
|
||||
"Unable to advance downloading state");
|
||||
return Ok((state, Some(Error::CantAdvanceState)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,11 +226,17 @@ impl<R: Runtime> DirMgr<R> {
|
|||
})?;
|
||||
|
||||
if let Some(receiver) = receiver {
|
||||
let _ = receiver.await;
|
||||
match receiver.await {
|
||||
Ok(()) => {
|
||||
info!("We have enough information to build circuits.");
|
||||
}
|
||||
Err(_) => {
|
||||
warn!("Bootstrapping task exited before finishing.");
|
||||
return Err(Error::CantAdvanceState.into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info!("We have enough information to build circuits.");
|
||||
|
||||
Ok(dirmgr)
|
||||
}
|
||||
|
||||
|
@ -316,7 +322,7 @@ impl<R: Runtime> DirMgr<R> {
|
|||
|
||||
'retry_attempt: for _ in retry_config.attempts() {
|
||||
let (newstate, recoverable_err) =
|
||||
bootstrap::download(Weak::clone(&weak), state, on_complete.take()).await?;
|
||||
bootstrap::download(Weak::clone(&weak), state, &mut on_complete).await?;
|
||||
state = newstate;
|
||||
|
||||
if let Some(err) = recoverable_err {
|
||||
|
|
Loading…
Reference in New Issue