From: Ian Jackson Date: Tue, 3 Aug 2021 23:02:16 +0000 (+0100) Subject: move rx check X-Git-Tag: hippotat/1.0.0~366 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=bfc45e3ccc2b8865e80c40c77a8b79177ea22a1e;p=hippotat.git move rx check Signed-off-by: Ian Jackson --- diff --git a/src/bin/client.rs b/src/bin/client.rs index fde8058..56a6c6d 100644 --- a/src/bin/client.rs +++ b/src/bin/client.rs @@ -199,15 +199,6 @@ async fn run_client( async { loop { - let rx_fullness = - if rx_queue.remaining() < ic.max_batch_down.sat() * 3 /* xxx */ { - // xxx make this separate option ? docs say server only - Ok(()) - } else { - Err(anyhow!("rx queue full")) - }; - let rx_fullness_ok = reporter.lock().report(None, rx_fullness); - select! { data = tx_stream.next_segment(), if packets.is_empty() => @@ -242,10 +233,17 @@ async fn run_client( }, _ = async { }, - if rx_fullness_ok.is_some() && - (reqs.len() < ic.target_requests_outstanding.sat() || - (reqs.len() < ic.max_requests_outstanding.sat() && - ! upbound.is_empty())) + if reporter.lock().report(None, { + if rx_queue.remaining() < ic.max_batch_down.sat() * 3 /* xxx */ { + // xxx make this separate option ? docs say server only + Ok(()) + } else { + Err(anyhow!("rx queue full")) + } + }).is_some() && + (reqs.len() < ic.target_requests_outstanding.sat() || + (reqs.len() < ic.max_requests_outstanding.sat() && + ! upbound.is_empty())) // xxx backpressure, if too much in rx_queue => {