Force set file length on stream

This commit is contained in:
Igor Katson 2024-04-29 19:14:46 +01:00
parent ea2dfd0500
commit 0ebd4aa128
2 changed files with 8 additions and 7 deletions

View file

@ -343,8 +343,13 @@ impl ManagedTorrent {
torrent: self,
};
if s.torrent.maybe_reconnect_needed_peers_for_file(file_id) {
s.torrent
.with_opened_file(file_id, |fd| fd.reopen(false))??;
s.torrent.with_opened_file(file_id, |fd| {
fd.reopen(false)?;
fd.file
.lock()
.set_len(fd.len)
.context("error setting file length")
})??;
}
streams.streams.insert(
s.stream_id,