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

Write valid pieces received directly to file #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Panko2128
Copy link

Keeping all pieces in a buffer may lead to memory issues for larger files, so the obvious fix is just reading the pieces into the file. This may

Files changed:
p2p.go

  • Download now takes in a filepath, and returns nil upon success
  • when a worker submits work to the results channel, the offset is calculated via piece index and written to the file

torrentfile.go

  • DownloadToFile just calls download, so it is actually not that necessary anymore

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

Successfully merging this pull request may close these issues.

1 participant