From: Ian Jackson Date: Wed, 4 Aug 2021 17:56:48 +0000 (+0100) Subject: make success_report_interval configuraable X-Git-Tag: hippotat/1.0.0~337 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=c453d881d8606ae142fc7f3a4782232a9e01f4df;p=hippotat.git make success_report_interval configuraable Signed-off-by: Ian Jackson --- diff --git a/README.config b/README.config index 9380fed..aa493bb 100644 --- a/README.config +++ b/README.config @@ -184,6 +184,10 @@ Ordinary settings, used by client only: max_batch_up Size limit for request payloads. [4000 bytes] + success_report_interval + If nonzero, report success periodically. Otherwise just + report it when we first have success. [3600 s] + http_retry If a request fails, wait this long before considering it "finished" - to limit rate of futile requests. [5 s] diff --git a/src/config.rs b/src/config.rs index dd78d75..a36ec58 100644 --- a/src/config.rs +++ b/src/config.rs @@ -38,6 +38,7 @@ pub struct InstanceConfig { #[client] pub max_requests_outstanding: u32, #[client] pub max_batch_up: u32, #[client] pub http_retry: Duration, + #[client] pub success_report_interval: Duration, #[client] pub url: Uri, #[client] pub vroutes: Vec, @@ -60,6 +61,7 @@ vroutes = '' ifname_client = hippo%d ifname_server = shippo%d max_clock_skew = 300 +success_report_interval = 3600 ipif = userv root ipif %{local},%{peer},%{mtu},slip,%{ifname} '%{rnets}' diff --git a/src/reporter.rs b/src/reporter.rs index 7cd5ae7..24cd6b8 100644 --- a/src/reporter.rs +++ b/src/reporter.rs @@ -34,7 +34,10 @@ impl<'r> Reporter<'r> { let now = Instant::now(); if let Some(rep) = &self.last_report { if now - rep.when < match rep.ok { - Ok(()) => Duration::from_secs(3600), // xxx config? + Ok(()) => match self.ic.success_report_interval { + z if z == Duration::default() => return, + nonzero => nonzero, + }, Err(()) => self.ic.effective_http_timeout, } { return