chiark / gitweb /
server: change type of checkn
[hippotat.git] / src / bin / client.rs
index 2578f7aabc6c5421b42be7ff254b3ca12d7fd19a..d73eceb221277819c858df45c602171d7d6b12aa 100644 (file)
@@ -48,6 +48,7 @@ fn submit_request<'r, 'c:'r, C:HCC>(
   let time_t = time_t_now();
   let time_t = format!("{:x}", time_t);
   let hmac = token_hmac(c.ic.secret.0.as_bytes(), time_t.as_bytes());
+  //dbg!(DumpHex(&hmac));
   let mut token = time_t;
   write!(token, " ").unwrap();
   base64::encode_config_buf(&hmac, BASE64_CONFIG, &mut token);
@@ -139,7 +140,9 @@ fn submit_request<'r, 'c:'r, C:HCC>(
       let status = resp.status();
       let mut resp = resp.into_body();
       let max_body = c.ic.max_batch_down.sat() + MAX_OVERHEAD;
-      let resp = read_limited_bytes(max_body, &mut resp).await
+      let resp = read_limited_bytes(
+        max_body, default(), default(), &mut resp
+      ).await
         .discard_data().context("fetching response body")?;
 
       if ! status.is_success() {
@@ -273,11 +276,13 @@ async fn run_client<C:HCC>(
           if let Some(got) = got {
             
             //eprintln!("got={:?}", DumpHex(&got));
-            match checkn(SlipNoConv,ic.mtu, &got, &mut rx_queue, |header| {
+            match checkn(SlipNoConv,ic.mtu, &got, |header| {
               let addr = ip_packet_addr::<true>(header)?;
               if addr != ic.link.client.0 { throw!(PE::Dst(addr)) }
               Ok(())
-            }, |e| error!("{} #{}: rx discarding: {}", &ic, req_num, e)) {
+            }, |o| rx_queue.push(o),
+               |e| error!("{} #{}: rx discarding: {}", &ic, req_num, e))
+            {
               Ok(()) => reporter.lock().success(),
               Err(ErrorOnlyBad) => {
                 reqs.push(Box::pin(async {