GGist / bip-rs

BitTorrent Infrastructure Project In Rust
Apache License 2.0
296 stars 33 forks source link

Create BlockIdentifier Message Type #138

Open GGist opened 7 years ago

GGist commented 7 years ago

Sometimes bip_select needs to tell clients to send a PieceMessage, but it wont know the actual payload. The clients will generally have to use something like bip_disk to get the payload from some fs to actually send the message.

We want bip_select to send a variant of PieceMessage without the data portion so clients dont get confused and think they can send that message without grabbing the data first. A wrapper type named something like BlockIdentifier would allow this, and we could use this type internally in RequestMessage, CancelMessage, as well as PieceMessage.

GGist commented 7 years ago

For tighter integration, we could also re-use bip_disks BlockMetadata type.

This would be even better if we separated these vocabulary types out into a separate crate.