frostwire / frostwire-jlibtorrent

A swig Java interface for libtorrent by the makers of FrostWire. Develop libtorrent based apps with the joy of coding in Java.
http://www.frostwire.com
MIT License
444 stars 137 forks source link

Torrent state remains as FINISHED even after a file priority is changed from Ignored to something else #243

Closed vickyoo7 closed 3 years ago

vickyoo7 commented 3 years ago

If i add a torrent with multiple files and set Priority of some files to IGNORE after the download is complete if i change the priority of the ignored files to NORMAL or something else the state of the torrent remains FINISHED and nothing is downloaded. I checked the the priorities are being changed in the Torrent handle but the state remains FINISHED. If i don't use the resume file torrent is forced checked and everything works fine (manually doing a force recheck doesn't work). Looks like the state in resume file is not getting reset after priority of files are changed

gubatron commented 3 years ago

That's a feature, not a bug. http://libtorrent.org/tutorial-ref.html#resuming-torrents

You can't resume torrents just by changing the priorities once it's gone to finished.

When resuming a download, the bittorrent engine must restore the state of the downloading torrent, specifically which parts of the file(s) are downloaded. There are two approaches to doing this:

read every piece of the downloaded files from disk and compare it against its expected hash. save, to disk, the state of which pieces (and partial pieces) are downloaded, and load it back in again when resuming. If no resume data is provided with a torrent that's added, libtorrent will employ (1) by default.

vickyoo7 commented 3 years ago

Thanks for the info