chiark / gitweb /
report, hook in success
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 3 Aug 2021 23:55:10 +0000 (00:55 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 3 Aug 2021 23:55:20 +0000 (00:55 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bin/client.rs
src/reporter.rs

index 95d473011bf638e0a13456227b37e52dda337039..9ae11353aa43f3b47d93d1cddd88f33cc404f032 100644 (file)
@@ -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<C:HCC>(
         },
 
         _ = 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<C:HCC>(
           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::<true>(header)?;
index 04a8e49e2bd1b4df5e23df2b1b555b0a766df706..d9ad4650cee7fc7ebde63c7925172719267e58ae 100644 (file)
@@ -13,7 +13,10 @@ impl<'r> Reporter<'r> {
     ic
   } }
   
-  pub fn report<T>(&mut self, req_num: Option<ReqNum>, r: Result<T,AE>)
+  pub fn success(&mut self) {
+    info!("{}: success", self.ic); // xxx
+  }
+  pub fn filter<T>(&mut self, req_num: Option<ReqNum>, r: Result<T,AE>)
                    -> Option<T> {
     match r {
       Ok(t) => {