Prioritizing torrent download sequences using libtorrent

Suppose I have 2+ clients (developed by me) ALL using libtorrent ( http://www.rasterbar.com/products/libtorrent/manual.html#queuing )

Is it possible to prioritize file download from other clients so that they download the chunks / chunks of the file (regardless of the terminology here) from the beginning of the file to the end and not quite in random order?

(of course I allow some "multiplexing" / "intertwining" chunks for reasons of accessibility and performance, but the goal here is to download as linearly and quickly as possible from the beginning of the file to the end as possible)

The goal I'm thinking about right now is obviously to preview the file. How can I do this most efficiently using libtorrent / perhaps another C ++ torrent library?

(I'm not very interested in torrent implementations using non-binary languages ​​like Java or Python - I need machine code for performance and security reasons, so C, C ++, or perhaps D will all fit the bill)

+1


source to share


1 answer


You can prioritize parts and files with torrent_handle::prioritize_pieces()

and torrent_handle::prioritize_files()

. See the documentation .

This will not be enough to load in order. To do this, you can enable progressive download with torrent_handle::set_sequential_download()

. This will trigger new requests in the order. Keep in mind that the time it takes for the request to run depends on who you are talking to. Running requests in order does not necessarily mean getting the parts in order.

There is another mechanism to try to do this. torrent_handle::set_piece_deadline()

used to set the target completion time for a chunk. Such chunks are considered time critical shapes, and they are ordered by their deadline, and the fastest peers are used to request blocks from these chunks, trying to load them at the deadline.



Now I also get the impression that you want two separate clients (presumably running on different machines) to coordinate which parts they download. It is right? It's not entirely clear what you are asking for, but there is no easy way to ask libtorrent to do this.

You can write a libtorrent plugin that implements a new extension message for these clients to communicate and coordinate, which can deselect some of the parts that another client is downloading by setting their priority to 0.

+2


source







All Articles