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 ability to seed torrent #57

Merged
merged 20 commits into from
Nov 25, 2020
Merged

Add ability to seed torrent #57

merged 20 commits into from
Nov 25, 2020

Conversation

vimpunk
Copy link
Owner

@vimpunk vimpunk commented Nov 19, 2020

Closes #50

cratetorrent/src/disk/io/piece.rs Show resolved Hide resolved
cratetorrent/src/disk/io/file.rs Outdated Show resolved Hide resolved
cratetorrent/src/disk.rs Show resolved Hide resolved
cratetorrent/src/disk/io/torrent.rs Outdated Show resolved Hide resolved
cratetorrent/src/peer.rs Outdated Show resolved Hide resolved
@@ -84,6 +84,20 @@ impl PiecePicker {
Ok(interested)
}

pub fn register_piece_availability(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for this

cratetorrent/src/torrent.rs Show resolved Hide resolved
cratetorrent/src/torrent.rs Outdated Show resolved Hide resolved
cratetorrent/src/disk.rs Outdated Show resolved Hide resolved
// stops reading in from the file if reaching EOF. We do need to advance
// the iovecs read buffer cursor after a read as we may want to read
// from other files after this one, in which case the cursor should
// be on the next byte to read to.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: read from

cratetorrent/src/iovecs.rs Outdated Show resolved Hide resolved
@vimpunk vimpunk force-pushed the seed-torrent branch 2 times, most recently from 98b4ff9 to 3128fa6 Compare November 22, 2020 13:13
@vimpunk
Copy link
Owner Author

vimpunk commented Nov 22, 2020

Some more todos:

  • regression test for not erroring out on reading missing data (stuck in infinite loop due to reading 0 bytes and not advancing the input iovecs)
  • send have message on completed piece (only to peers that don't have the piece?)
  • refactor peer session start methods: lots of duplication yet similar code
  • summarize seeding related components in design doc
  • validate block infos and piece indices received from peer: request, have, block, cancel

@vimpunk vimpunk merged commit eee3eb5 into master Nov 25, 2020
@vimpunk vimpunk deleted the seed-torrent branch November 25, 2020 23:45
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.

Seed a torrent
1 participant