anacrolix / torrent

Full-featured BitTorrent client package and utilities
Mozilla Public License 2.0
5.58k stars 630 forks source link

Basic support for responding to HashRequest #969

Closed Mivik closed 2 months ago

Mivik commented 2 months ago

This PR implemented serialization of Hashes and HashReject messages, and the logic of responding to HashRequest. Note that some code relevant to Piece is changed and should be reviewed.

anacrolix commented 2 months ago

Thanks! Nice implementation. The implementation of hasPieceLayer looks correct. You've constrained the checks to v2 fields in the info but that makes sense. Were you seeing performance issues with the old implementation, or just tidying up?

anacrolix commented 2 months ago

Ok I tested it pretty well.