Check the chunk before uploading

This commit is contained in:
Igor Katson 2021-06-28 22:21:21 +01:00
parent df282ae9d8
commit b26af687b7
4 changed files with 22 additions and 9 deletions

View file

@ -116,6 +116,13 @@ impl ChunkTracker {
.unwrap()
}
pub fn is_chunk_ready_to_upload(&self, chunk: &ChunkInfo) -> bool {
self.have
.get(chunk.piece_index.get() as usize)
.map(|b| *b)
.unwrap_or(false)
}
// return true if the whole piece is marked downloaded
pub fn mark_chunk_downloaded<ByteBuf>(
&mut self,