send a lot of acks at the end
This commit is contained in:
parent
6be8f77a1b
commit
ce56278a68
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue