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

Add torrent.rescanFiles() to allow manual verify #1650

Merged
merged 1 commit into from Jul 9, 2019

Conversation

@jhiesey
Copy link
Contributor

jhiesey commented Jun 24, 2019

Useful if files are modified externally to webtorrent. Needed for Internet Archive use case.

Copy link
Member

feross left a comment

Generally looks good. See inline comments. Also, can you add documentation?

lib/torrent.js Outdated Show resolved Hide resolved
lib/torrent.js Outdated Show resolved Hide resolved
lib/torrent.js Outdated Show resolved Hide resolved
lib/torrent.js Outdated Show resolved Hide resolved
@jhiesey jhiesey force-pushed the jhiesey:rescan branch from 7dc5d2c to 52b7aeb Jul 7, 2019
Copy link
Member

feross left a comment

LGTM, except for the documentation not being right. Lmk if you agree

docs/api.md Outdated
@@ -366,6 +366,13 @@ connections, nor does it pause the streams of existing connections or their wire

Resume connecting to new peers.

## `torrent.verifyPieces([function callback (err) {}])`

This comment has been minimized.

Copy link
@feross

feross Jul 9, 2019

Member

The method is supposed to be called rescanFiles, right?

This comment has been minimized.

Copy link
@jhiesey

jhiesey Jul 9, 2019

Author Contributor

D'oh! yes.

docs/api.md Outdated
## `torrent.verifyPieces([function callback (err) {}])`

Verify the hashes of all pieces in the store. Useful if the store has been modified
outside WebTorrent. If a piece hash is incorrect, the torrent will be destroyed, and

This comment has been minimized.

Copy link
@feross

feross Jul 9, 2019

Member

If a piece hash is incorrect, nothing happens. The underlying _verifyPieces method just marks the valid pieces as verified and ignores the invalid pieces. So I think this should say that the callback is called when verification is complete, and an error is returned if the torrent is destroyed during verification for any reason. But, null will be returned if verification completes successfully, whether or not all the pieces hash correctly or not.

This comment has been minimized.

Copy link
@jhiesey

jhiesey Jul 9, 2019

Author Contributor

Yes, you're right. I made this change a while ago and didn't look at it closely enough again.

Useful if files are modified externally to webtorrent.
@jhiesey jhiesey force-pushed the jhiesey:rescan branch from 52b7aeb to ae89888 Jul 9, 2019
@feross
feross approved these changes Jul 9, 2019
Copy link
Member

feross left a comment

LGTM! Thanks for making all the changes!

@feross feross merged commit cd96523 into webtorrent:master Jul 9, 2019
3 checks passed
3 checks passed
WIP Ready for review
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@feross

This comment has been minimized.

Copy link
Member

feross commented Jul 9, 2019

Released as 0.105.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.