From 8bd863f938e403e82dc9c38e36b4e059ec5cf5c0 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 4 Aug 2021 00:55:10 +0100 Subject: [PATCH] report, hook in success Signed-off-by: Ian Jackson --- src/bin/client.rs | 5 +++-- src/reporter.rs | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bin/client.rs b/src/bin/client.rs index 95d4730..9ae1135 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -135,7 +135,7 @@ fn submit_request<'r, 'c:'r, C:HCC>( Ok::<_,AE>(resp) }).await? }.await; - let r = c.reporter.lock().report(Some(req_num), r); + let r = c.reporter.lock().filter(Some(req_num), r); if r.is_none() { tokio::time::sleep(c.ic.http_retry).await; @@ -239,7 +239,7 @@ async fn run_client( }, _ = async { }, - if reporter.lock().report(None, { + if reporter.lock().filter(None, { if rx_queue.remaining() < ic.max_batch_down.sat() * 3 /* xxx */ { // xxx make this separate option ? docs say server only Ok(()) @@ -263,6 +263,7 @@ async fn run_client( reqs.swap_remove(goti); if let Some(got) = got { + reporter.lock().success(); //eprintln!("got={:?}", DumpHex(&got)); checkn(SlipNoConv,ic.mtu, &got, &mut rx_queue, |header| { let addr = ip_packet_addr::(header)?; diff --git a/src/reporter.rs b/src/reporter.rs index 04a8e49..d9ad465 100644 --- a/src/reporter.rs +++ b/src/reporter.rs @@ -13,7 +13,10 @@ impl<'r> Reporter<'r> { ic } } - pub fn report(&mut self, req_num: Option, r: Result) + pub fn success(&mut self) { + info!("{}: success", self.ic); // xxx + } + pub fn filter(&mut self, req_num: Option, r: Result) -> Option { match r { Ok(t) => { -- 2.30.2