DirMgr: Detect that directory state is ready if it begins with all MDs
Previously, we'd only call PendingNetDir::upgrade_if_necesessary when adding a microdescriptor. But if it began already having all of its descriptors (because we found them in the cache), we wouldn't actually upgrade it to a PendingNetDir::Yielding, which would make it unusable, and would make us schedule its reset time too far in the future. Fixes #802.
This commit is contained in:
parent
1af2296cc2
commit
f61fd9609a
|
@ -902,10 +902,15 @@ impl<R: Runtime> GetMicrodescsState<R> {
|
|||
partial_dir.fill_from_previous_netdir(old_dir);
|
||||
}
|
||||
|
||||
// Always upgrade at least once: otherwise, we won't notice we're ready unless we
|
||||
// add a microdescriptor.
|
||||
let mut partial = PendingNetDir::Partial(partial_dir);
|
||||
partial.upgrade_if_necessary();
|
||||
|
||||
GetMicrodescsState {
|
||||
cache_usage,
|
||||
n_microdescs,
|
||||
partial: PendingNetDir::Partial(partial_dir),
|
||||
partial,
|
||||
meta,
|
||||
newly_listed: Vec::new(),
|
||||
reset_time,
|
||||
|
|
Loading…
Reference in New Issue