Add some writer flushes that are probably necessary

This commit is contained in:
Olivier 'reivilibre' 2022-06-14 19:57:14 +01:00
parent d384b1bcbd
commit fc29c6fca1
1 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,7 @@ pub fn negotiate_bypassed_pile<R: Read, W: Write>(
write_message(writer, &my_full_pipeline)?;
write_message(writer, &my_bypass_pipeline)?;
writer.flush()?;
let their_full_pipeline = read_message::<_, Vec<PipelineDescription>>(reader)?;
let their_bypass_pipeline = read_message::<_, Vec<PipelineDescription>>(reader)?;
@ -158,6 +159,7 @@ pub fn offering_side<R: Read, W: Write>(
}
write_message(writer, &chunks_to_offer)?;
writer.flush()?;
let chunks_to_skip: BTreeSet<ChunkId> = read_message(reader)?;
let chunks_to_send: Vec<ChunkId> = chunks_to_offer
@ -179,6 +181,8 @@ pub fn offering_side<R: Read, W: Write>(
progress.inc_progress(1);
}
writer.flush()?;
Ok(())
}
@ -209,6 +213,7 @@ pub fn accepting_side<R: Read, W: Write>(
}
write_message(writer, &wanted_pointers)?;
writer.flush()?;
let offered_chunks: BTreeSet<ChunkId> = read_message(reader)?;
let mut chunks_to_skip: BTreeSet<ChunkId> = BTreeSet::new();
@ -219,6 +224,7 @@ pub fn accepting_side<R: Read, W: Write>(
}
write_message(writer, &chunks_to_skip)?;
writer.flush()?;
let num_chunks_to_recv = offered_chunks.len() - chunks_to_skip.len();
@ -248,6 +254,7 @@ pub fn accepting_side<R: Read, W: Write>(
for (pointer_name, pointer_data) in &offered_pointers {
pile.write_pointer(pointer_name, pointer_data)?;
}
pile.flush()?;
Ok(())
}