Skip to content
Snippets Groups Projects
Commit 409c5dd6 authored by Ian Jackson's avatar Ian Jackson
Browse files

Use new upstream humantime_serde_option feature

Replace all uses of our copy of this code.
parent 8b8c2a42
No related branches found
No related tags found
1 merge request!406Replace humantime_serde_option with upstream code
......@@ -17,7 +17,6 @@ use std::collections::HashMap;
use std::path::Path;
use std::path::PathBuf;
use std::time::Duration;
pub use tor_basic_utils::humantime_serde_option;
pub use tor_config::{CfgPath, ConfigBuildError, Reconfigure};
/// Types for configuring how Tor circuits are built.
......@@ -77,20 +76,20 @@ pub struct StreamTimeoutConfig {
/// to a host?
#[builder(default = "default_connect_timeout()")]
#[serde(with = "humantime_serde", default = "default_connect_timeout")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) connect_timeout: Duration,
/// How long should we wait before timing out when resolving a DNS record?
#[builder(default = "default_dns_resolve_timeout()")]
#[serde(with = "humantime_serde", default = "default_dns_resolve_timeout")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) resolve_timeout: Duration,
/// How long should we wait before timing out when resolving a DNS
/// PTR record?
#[builder(default = "default_dns_resolve_ptr_timeout()")]
#[serde(with = "humantime_serde", default = "default_dns_resolve_ptr_timeout")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) resolve_ptr_timeout: Duration,
}
......
......@@ -4,7 +4,6 @@
//!
//! Most types in this module are re-exported by `arti-client`.
use tor_basic_utils::humantime_serde_option;
use tor_config::ConfigBuildError;
use derive_builder::Builder;
......@@ -121,7 +120,7 @@ pub struct PreemptiveCircuitConfig {
/// available for that port?
#[builder(default = "default_preemptive_duration()")]
#[serde(with = "humantime_serde", default = "default_preemptive_duration")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) prediction_lifetime: Duration,
/// How many available circuits should we try to have, at minimum, for each
......@@ -150,7 +149,7 @@ pub struct CircuitTiming {
/// it out for new requests?
#[builder(default = "default_max_dirtiness()")]
#[serde(with = "humantime_serde", default = "default_max_dirtiness")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) max_dirtiness: Duration,
/// When a circuit is requested, we stop retrying new circuits
......@@ -158,7 +157,7 @@ pub struct CircuitTiming {
// TODO: Impose a maximum or minimum?
#[builder(default = "default_request_timeout()")]
#[serde(with = "humantime_serde", default = "default_request_timeout")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) request_timeout: Duration,
/// When a circuit is requested, we stop retrying new circuits after
......@@ -173,7 +172,7 @@ pub struct CircuitTiming {
/// request.
#[builder(default = "default_request_loyalty()")]
#[serde(with = "humantime_serde", default = "default_request_loyalty")]
#[builder(attrs(serde(with = "humantime_serde_option")))]
#[builder(attrs(serde(with = "humantime_serde::option")))]
pub(crate) request_loyalty: 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