Skip to content
Snippets Groups Projects
Commit a9bae9ad authored by eta's avatar eta
Browse files

tor-dirmgr/state.rs: refactor GetConsensusState::new

- GetConsensusState::new now takes a set of parameters matching what it
  actually needs, instead of just taking a writedir. (It still *does*
  take a writedir, and indeed still uses it for basically everything,
  but that will eventually go away.)
- Its call sites were updated.
  - Some tests now need to take a runtime, and got indented a lot as a
    result.
  - Resetting was made non-functional, because we need to thread through
    the parameters passed to GetConsensusState to all of the other
    states, too. This will happen in a later commit.
parent 62ece0ea
No related branches found
No related tags found
No related merge requests found
......@@ -517,7 +517,7 @@ impl<R: Runtime> DirMgr<R> {
weak: Weak<Self>,
mut on_complete: Option<oneshot::Sender<()>>,
) -> Result<()> {
let mut state: Box<dyn DirState> = Box::new(state::GetConsensusState::new(
let mut state: Box<dyn DirState> = Box::new(state::GetConsensusState::bodge_new(
Weak::clone(&weak),
CacheUsage::CacheOkay,
)?);
......@@ -727,7 +727,8 @@ impl<R: Runtime> DirMgr<R> {
///
/// Return false if there is no such consensus.
async fn load_directory(self: &Arc<Self>) -> Result<bool> {
let state = state::GetConsensusState::new(Arc::downgrade(self), CacheUsage::CacheOnly)?;
let state =
state::GetConsensusState::bodge_new(Arc::downgrade(self), CacheUsage::CacheOnly)?;
let _ = bootstrap::load(Arc::clone(self), Box::new(state)).await?;
Ok(self.netdir.get().is_some())
......
This diff is collapsed.
......@@ -18,8 +18,8 @@ use crate::{Error, Result};
use std::cell::RefCell;
use std::collections::HashMap;
use std::fs::File;
use std::str::Utf8Error;
use std::ops::{Deref, DerefMut};
use std::str::Utf8Error;
use std::time::SystemTime;
use time::Duration;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment