send a lot of acks at the end

This commit is contained in:
Milo Turner 2020-03-14 15:03:55 -04:00
parent 6be8f77a1b
commit ce56278a68
1 changed files with 3 additions and 8 deletions

View File

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