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 createServer without waiting to finish hash checks? #1533

Closed
untitledlt opened this issue Oct 26, 2018 · 5 comments
Closed

Is it possible to createServer without waiting to finish hash checks? #1533

untitledlt opened this issue Oct 26, 2018 · 5 comments
Labels

Comments

@untitledlt
Copy link
Contributor

@untitledlt untitledlt commented Oct 26, 2018

F.e. if 10 GB movie is already downloaded, it takes almost a minute to hash torrent and only then i can torrent. createServer. If it's a new torrent I can start playback in 10 seconds so it's faster to delete files and start over.
Would it be possible to start createServer while hashing is still in progress?

@SilentBot1 SilentBot1 added the question label Oct 26, 2018
@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 26, 2018

Hey @untitledlt,

Could I ask for you to show code examples of what you are talking about?

if 10 GB movie is already downloaded, it takes almost a minute to hash torrent and only then i can torrent. createServer

How are you adding the already downloaded torrent? Are you calling client.seed or client.add?

If you are sure you have the entire torrent downloaded, you can pass the option skipVerify: true in client.add to disable verifying downloaded chunks, note if the full file isn't downloaded and this option is set to true, the torrent will think it has all the parts and not continue the partial download.

Also seeding via client.add will require either another peer to already have the metadata or require the torrent to be added via its metadata (either .torrent or saved parse-torrent object) but will allow all verification to be skipped in conjunction with the option skipVerify.

As this is a question I'm going to close this, but feel free to continue the discussion, I'll be happy to help.

@SilentBot1 SilentBot1 closed this Oct 26, 2018
@untitledlt

This comment has been minimized.

Copy link
Contributor Author

@untitledlt untitledlt commented Oct 26, 2018

Thanks for an answer!
I'm gonna keep all .torrent files in separate folder and i'll add them with client.add on every app restart.
New .torrents will be added the same way while application is running.

I guess I should store every torrent state to database so i would know which torrent is completed and use skipVerify: true for completed ones. Or is there a better way?

But still i don't understand when i should use client.seed and why it's better than client.add?

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 26, 2018

@untitledlt I don't help with webtorrent-desktop too much but I believe that is similar to how they handle it. I would recommend taking a look at how webtorrent-desktop handles things but the code is complex and not the easiest to read.

client.seed should be used when you want to create a torrent from complete files, this includes creating the .torrent file which needs to generate the hash of each chunk for verification.

client.add should be used when you want to add an existing torrent and don't want to re-generate the metadata (though verifying the integrity of the file against the .torrent file before you start seeding is recommended but takes time).

Hope this helps.

@untitledlt

This comment has been minimized.

Copy link
Contributor Author

@untitledlt untitledlt commented Oct 26, 2018

Looks like client.add is all i need then.
Is it possible to trigger hash check later if i add torrent with skipVerify: true?

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 26, 2018

You can't re-verify the torrent easily after passing skipVerify currently. Possibly a option to re-verify a torrent would be something that could be looked into in the future.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

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