HS configuration: Plumb configuration through (fmt)

Apply deferred rustfmt churn.
This commit is contained in:
Ian Jackson 2023-06-26 12:59:28 +01:00
parent 3ebc3216e3
commit a0b6f34e42
3 changed files with 29 additions and 11 deletions

View File

@ -314,7 +314,10 @@ impl StreamPrefs {
/// If `Auto`, the behaviour depends on the `address_filter.allow_onion_addrs`
/// configuration option, which is in turn enabled by default.
#[cfg(feature = "onion-service-client")]
pub fn connect_to_onion_services(&mut self, connect_to_onion_services: BoolOrAuto) -> &mut Self {
pub fn connect_to_onion_services(
&mut self,
connect_to_onion_services: BoolOrAuto,
) -> &mut Self {
self.connect_to_onion_services = connect_to_onion_services;
self
}

View File

@ -410,7 +410,7 @@ impl<'c, R: Runtime, M: MocksForConnect<R>> Context<'c, R, M> {
/// Returns an error if no valid descriptor could be found.
async fn descriptor_ensure<'d>(&self, data: &'d mut DataHsDesc) -> Result<&'d HsDesc, CE> {
let _ = self.config.retry; // TODO HS actually use this value
// TODO HS Use `hs_desc_fetch_attempts` from configuration
// TODO HS Use `hs_desc_fetch_attempts` from configuration
/// Maxmimum number of hsdir connection and retrieval attempts we'll make
const MAX_TOTAL_ATTEMPTS: usize = 6;
/// Limit on the duration of each retrieval attempt
@ -1495,7 +1495,16 @@ mod test {
secret_keys_builder.ks_hsc_desc_enc(sk);
let secret_keys = secret_keys_builder.build().unwrap();
let ctx = Context::new(&runtime, &mocks, netdir, Default::default(), hsid, secret_keys, mocks.clone()).unwrap();
let ctx = Context::new(
&runtime,
&mocks,
netdir,
Default::default(),
hsid,
secret_keys,
mocks.clone(),
)
.unwrap();
let _got = AssertUnwindSafe(ctx.connect(&mut data))
.catch_unwind() // TODO HS TESTS: remove this and the AssertUnwindSafe

View File

@ -402,14 +402,20 @@ fn obtain_circuit_or_continuation_info<D: MockableConnectorData>(
let connect_future = async move {
let mut data = data;
let got =
AssertUnwindSafe(D::connect(&connector, netdir, config, hsid, &mut data, secret_keys))
.catch_unwind()
.await
.unwrap_or_else(|_| {
data = D::default();
Err(internal!("hidden service connector task panicked!").into())
});
let got = AssertUnwindSafe(D::connect(
&connector,
netdir,
config,
hsid,
&mut data,
secret_keys,
))
.catch_unwind()
.await
.unwrap_or_else(|_| {
data = D::default();
Err(internal!("hidden service connector task panicked!").into())
});
let now = connector.runtime.now();
let last_used = now;