Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to check torrent completion without making any changes to filesystem? #602

Open
ManlyMarco opened this issue Jan 19, 2023 · 3 comments

Comments

@ManlyMarco
Copy link

ManlyMarco commented Jan 19, 2023

I want to check which local files are different from what's given in a .torrent file and ask user to proceed or cancel. Adding and hash checking the torrent will create 0 byte files if they didn't exist, and it seems it will change files that fail the hash check as well, even without actually starting the download. This is a problem if the user choses to cancel since the expectation is that no changes have been made.

@ManlyMarco
Copy link
Author

ManlyMarco commented Jan 20, 2023

I believe I've found my main issue. One of the downloaded files from the torrent was removed after the torrent was completed.
Next time I ran my torrent load code, when verifying hashes some of the files showed less than 100 completion, which I believe is because they shared blocks with the missing file? The files were not actually changed on the filesystem until StartAsync was called, so I believe everything is working as intended?

The 0 byte placeholder files being created during a hash check before a torrent is started are still there. I can work around this by using MoveFileAsync, but unfortunately #598 stops me from doing that.

Please close this issue if neither of these are a bug.

Edit: Looks like the UsePartialFiles setting would solve all of my issues without having to manually use MoveFileAsync, but unfortunately it doesn't seem to be functional yet (please let me know if you do want bug reports for it).

Tested on 3.0.0-beta.rev0106.

@alanmcgovern
Copy link
Owner

Please do let me know what issues you have with UsePartialFiles. I can queue them up for fixes after i finish investigating the hang you reported.

Also +1 to the suggestion here. I think there should be no issue forcing files to be accessed in readonly mode when hashchecking, and to move the file truncating code to a place where read/write streams are used (i.e. definitely not part of hashchecking, or any of the code prior to actually 'downloading' a torrent).

@ManlyMarco
Copy link
Author

ManlyMarco commented Jan 24, 2023

I'll let you know if I end up testing UsePartialFiles futher in that case.

It would also be nice to be able to use fast resume data for the hash check, since currently to use fast resume it's necessary to start the torrent which will make changes to the filesystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants