mafintosh / torrent-stream

The low level streaming torrent engine that peerflix uses
MIT License
1.95k stars 227 forks source link

Request random pieces if all selections have been met #51

Open mafintosh opened 10 years ago

mafintosh commented 10 years ago

In order to be better swarm citizens we should probably think about changing piece strategy in all critical pieces have been downloaded.

A simple way of doing this would be do fetch random pieces if the selection array is empty.

asapach commented 10 years ago

"Rarest first" is also a good strategy: http://www.bittorrent.org/bittorrentecon.pdf

transitive-bullshit commented 10 years ago

I already implemented this for bittorrent-client here if anyone wants to port back over to torrent-stream. Note that bittorrent-client's internal piece selection logic is just a cleaned up, more modular version of torrent-stream's, so the port should be relatively straightforward.

On a side note, we really need to set a gameplan for better coordination between these two projects.

transitive-bullshit commented 10 years ago

Also note that rarest first is essentially equivalent to random selection in a healthy torrent but performs significantly better in an unhealthy torrent, so there's no reason not to go with rarest first over random.