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

load torrent skip check or how to make a fake fastresume file? #221

Closed TongxiJi closed 5 years ago

TongxiJi commented 5 years ago

As we know,torrent-check takes a lot of time especially many big files. Is there any way to skip this checking that we can sure the files are complete. Or we can make a fake fast-resume file?

gubatron commented 5 years ago

From libtorrent docs:

fast resume

The fast resume mechanism is a way to remember which pieces are downloaded and where they are put between sessions. You can generate fast resume data by calling save_resume_data() on torrent_handle. You can then save this data to disk and use it when resuming the torrent. libtorrent will not check the piece hashes then, and rely on the information given in the fast-resume data. The fast-resume data also contains information about which blocks, in the unfinished pieces, were downloaded, so it will not have to start from scratch on the partially downloaded pieces.

To use the fast-resume data you pass it to read_resume_data(), which will return an add_torrent_params object. Fields of this object can then be altered before passing it to async_add_torrent() or add_torrent(). The session will then skip the time consuming checks. It may have to do the checking anyway, if the fast-resume data is corrupt or doesn't fit the storage for that torrent.