diff --git a/crates/librqbit/src/chunk_tracker.rs b/crates/librqbit/src/chunk_tracker.rs index 254a831..d3a87cb 100644 --- a/crates/librqbit/src/chunk_tracker.rs +++ b/crates/librqbit/src/chunk_tracker.rs @@ -222,25 +222,6 @@ impl ChunkTracker { self.have[id.get() as usize] } - // None if wrong chunk - // true if did something - // false if didn't do anything - pub fn mark_chunk_request_cancelled( - &mut self, - index: ValidPieceIndex, - _chunk: u32, - ) -> Option { - if *self.have.get(index.get() as usize)? { - return Some(false); - } - // This will trigger the requesters to re-check each chunk in this piece. - let chunk_range = self.lengths.chunk_range(index); - if !self.chunk_status.get(chunk_range)?.all() { - self.queue_pieces.set(index.get() as usize, true); - } - Some(true) - } - pub fn mark_piece_broken_if_not_have(&mut self, index: ValidPieceIndex) { if self .have diff --git a/crates/librqbit/src/torrent_state/live/mod.rs b/crates/librqbit/src/torrent_state/live/mod.rs index a1b0cd6..896ca88 100644 --- a/crates/librqbit/src/torrent_state/live/mod.rs +++ b/crates/librqbit/src/torrent_state/live/mod.rs @@ -904,7 +904,7 @@ impl PeerHandler { req.chunk_index ); g.get_chunks_mut()? - .mark_chunk_request_cancelled(req.piece_index, req.chunk_index); + .mark_piece_broken_if_not_have(req.piece_index); } } PeerState::NotNeeded => {