Skip to content

TODO: Replace amplify with getset crate

There is an active TODO for using a different derive crate for getters, because amplify requires us to specify which fields to skip for generating getters, rather than ignoring them by default.

The code has been switched to use getset instead. We can specify whether fields should be copied or cloned, as well.

    pub struct CircuitTiming {
        /// How long after a circuit has first been used should we give
        /// it out for new requests?
        #[builder(default = "default_max_dirtiness()")]
        #[builder_field_attr(serde(default, with = "humantime_serde::option"))]
        pub(crate) max_dirtiness: Duration,
        /// When a circuit is requested, we stop retrying new circuits
        /// after this much time.
        #[builder(default = "default_request_timeout()")]
        #[builder_field_attr(serde(default, with = "humantime_serde::option"))]
        pub(crate) request_timeout: Duration,
        /// When a circuit is requested, we stop retrying new circuits after
        /// this many attempts.
        #[builder(default = "default_request_max_retries()")]
        pub(crate) request_max_retries: u32,
        /// When waiting for requested circuits, wait at least this long
        /// before using a suitable-looking circuit launched by some other
        /// request.
        #[builder(default = "default_request_loyalty()")]
        #[builder_field_attr(serde(default, with = "humantime_serde::option"))]
        pub(crate) request_loyalty: Duration,
        /// When an HS connection is attempted, we stop trying more hsdirs after this many attempts
        #[builder(default = "default_hs_max_attempts()")]
        #[getset(get_copy = "pub")]
        pub(crate) hs_desc_fetch_attempts: u32,
        /// When an HS connection is attempted, we stop trying intro/rendezvous
        /// after this many attempts
        #[builder(default = "default_hs_max_attempts()")]
        #[getset(get_copy = "pub")]
        pub(crate) hs_intro_rend_attempts: u32,
    }
    impl CircuitTiming {}
    impl CircuitTiming {
        /// When an HS connection is attempted, we stop trying more hsdirs after this many attempts
        #[inline(always)]
        pub fn hs_desc_fetch_attempts(&self) -> u32 {
            self.hs_desc_fetch_attempts
        }
        /// When an HS connection is attempted, we stop trying intro/rendezvous
        /// after this many attempts
        #[inline(always)]
        pub fn hs_intro_rend_attempts(&self) -> u32 {
            self.hs_intro_rend_attempts
        }
    }
Edited by thesw4rm

Merge request reports

Loading