wip(hs): publish-wait ceiling + CBT floor for Arti descriptor upload
Rescued from the uncommitted working tree on main. Not reviewed, not tested against the network: - PUBLISH_WAIT 180s -> 420s (Arti's per-HsDir upload timeout is 5m) - CBT_MIN_TIMEOUT_MSEC = 10_000 via override_net_params cbtmintimeout - status line now prints elapsed/publish-wait and current_problem() - tests/tor_hs.rs adjusted to match
This commit is contained in:
parent
a278e71627
commit
dcd458ab53
2 changed files with 59 additions and 13 deletions
|
|
@ -6,7 +6,6 @@
|
|||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use arti_client::config::TorClientConfigBuilder;
|
||||
use arti_client::{DormantMode, TorClient, TorClientConfig};
|
||||
use futures::StreamExt;
|
||||
use futures::io::{AsyncReadExt, AsyncWriteExt};
|
||||
|
|
@ -23,12 +22,7 @@ const BOOTSTRAP_LOG: &str = "info";
|
|||
type Client = Arc<TorClient<PreferredRuntime>>;
|
||||
|
||||
fn client_config(state_dir: &std::path::Path, cache_dir: &std::path::Path) -> TorClientConfig {
|
||||
std::fs::create_dir_all(state_dir).expect("state dir");
|
||||
std::fs::create_dir_all(cache_dir).expect("cache dir");
|
||||
let mut builder = TorClientConfigBuilder::from_directories(state_dir, cache_dir);
|
||||
// Temp dirs sit under $TMP; skip fs-mistrust on the parent tree.
|
||||
builder.storage().permissions().dangerously_trust_everyone();
|
||||
builder.build().expect("TorClientConfig")
|
||||
onionwire::hs::client_config(state_dir, cache_dir)
|
||||
}
|
||||
|
||||
async fn bootstrapped(state_dir: &std::path::Path, cache_dir: &std::path::Path) -> Client {
|
||||
|
|
@ -89,7 +83,7 @@ async fn launch_echo(
|
|||
}
|
||||
|
||||
async fn wait_until_published(svc: &RunningOnionService, label: &str) {
|
||||
let deadline = Instant::now() + Duration::from_secs(180);
|
||||
let deadline = Instant::now() + onionwire::hs::PUBLISH_WAIT;
|
||||
let mut events = svc.status_events();
|
||||
loop {
|
||||
let st = svc.status();
|
||||
|
|
@ -103,7 +97,8 @@ async fn wait_until_published(svc: &RunningOnionService, label: &str) {
|
|||
}
|
||||
if Instant::now() >= deadline {
|
||||
panic!(
|
||||
"{label}: onion service did not publish within 180s: {:?}",
|
||||
"{label}: onion service did not publish within {}s: {:?}",
|
||||
onionwire::hs::PUBLISH_WAIT.as_secs(),
|
||||
st.state()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue