vimpunk / cratetorrent

A BitTorrent V1 engine library for Rust (and currently Linux)
473 stars 35 forks source link

Maximize cache hits in peers #82

Open vimpunk opened 3 years ago

vimpunk commented 3 years ago

Most clients will read-ahead blocks after a requested piece. If a peer is sufficiently fast, we should opt to download the whole piece from a single peer so that only that peer caches the piece. Otherwise if we're requesting blocks from multiple peers, each of those will pull the piece into their read caches, which would be a waste if each of them could pull different pieces into their cache, speeding up the download.