diff --git a/hptp-recv/src/main.rs b/hptp-recv/src/main.rs index 826047c..819f809 100644 --- a/hptp-recv/src/main.rs +++ b/hptp-recv/src/main.rs @@ -131,7 +131,6 @@ where const DELAY_MS: u64 = 1000; let mut deadline = Instant::now(); - let mut to_send = vec![]; loop { let timer = tokio::time::delay_until(deadline); @@ -169,14 +168,10 @@ where } }; - { - let idxs = sink.ack_idxs(); + let num_acks = if sink.is_file_complete() { 8 } else { 1 }; + for _ in 0..num_acks { log.debug_msg(format!("send acks {:?}", idxs)).await; - to_send.push(DownMsg::Ack { idxs: idxs.clone() }); - to_send.push(DownMsg::Ack { idxs }); - } - - for m in to_send.drain(..) { + let m = DownMsg::Ack { idxs: sink.ack_idxs() }; match peer.send(m).await { Ok(()) => (), Err(hptp::peer::SendError::NoTarget) => log.debug_msg("no target").await,