chiark / gitweb /
make success_report_interval configuraable
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Aug 2021 17:56:48 +0000 (18:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 4 Aug 2021 17:57:01 +0000 (18:57 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README.config
src/config.rs
src/reporter.rs

index 9380fed4e2339db302185b2bb441a0d072be926d..aa493bb7a41db77108259cb2c167bb03a00cf661 100644 (file)
@@ -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]
index dd78d75733dbdcfddebf33978e63cc39f7ab219c..a36ec584f987864a27bb2803ca553dce9d574dd8 100644 (file)
@@ -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<IpNet>,
 
@@ -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}'
 
index 7cd5ae751bca8c6cc3406492d1b38515055f9999..24cd6b82822f44756b3b95aafc725e18a4445251 100644 (file)
@@ -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