Check the chunk before uploading
This commit is contained in:
parent
df282ae9d8
commit
b26af687b7
4 changed files with 22 additions and 9 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue