diff --git a/crates/librqbit/src/chunk_tracker.rs b/crates/librqbit/src/chunk_tracker.rs index 70970c3..e9e0f2f 100644 --- a/crates/librqbit/src/chunk_tracker.rs +++ b/crates/librqbit/src/chunk_tracker.rs @@ -368,6 +368,10 @@ impl ChunkTracker { self.hns = res; Ok(res) } + + pub(crate) fn get_selected_pieces(&self) -> &BF { + &self.selected + } } #[cfg(test)] diff --git a/crates/librqbit/src/torrent_state/streaming.rs b/crates/librqbit/src/torrent_state/streaming.rs index 4647037..5a2b998 100644 --- a/crates/librqbit/src/torrent_state/streaming.rs +++ b/crates/librqbit/src/torrent_state/streaming.rs @@ -351,15 +351,7 @@ impl ManagedTorrent { file_torrent_abs_offset: fd_offset, torrent: self, }; - if s.torrent.maybe_reconnect_needed_peers_for_file(file_id) { - // TODO: get rid of reopening files, it's such a source of bugs and complexity - s.torrent.with_opened_files(|files| { - for file in files { - file.reopen(false)?; - } - Ok::<_, anyhow::Error>(()) - })??; - } + s.torrent.maybe_reconnect_needed_peers_for_file(file_id); streams.streams.insert( s.stream_id, StreamState {