arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation

Home Page:http://libtorrent.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: externally determined choking algorithm

netheril96 opened this issue · comments

Currently libtorrent have three different strategies of unchoking algorithms, but none of them is good enough to stop leeching peers like Xunlei. I want to add more, but adding them to libtorrent will require, it seems to me, passing a very high bar.

So can we instead add an interface allowing libtorrent callers to determine how to unchoke, by passing a callback? This way I can experiment with all different strategies without modifying libtorrent every time.

I'm willing to file a PR, if the owner is OK with this idea.

libtorrent is open source, it's always possible to patch it and build your own version of it. Are you looking for being able to install a pre-built binary from a package manager and still customize the choking strategy? Is there a strong use case for this, compared to patching and building it yourself?

What do you mean by "stop leeching peers"? downloading without uploading anything is a natural part of the protocol.
What I suspect you're really looking for are ways to improve your download rate by tweaking the selection of peers you unchoke, and when.

libtorrent is open source, it's always possible to patch it and build your own version of it. Are you looking for being able to install a pre-built binary from a package manager and still customize the choking strategy? Is there a strong use case for this, compared to patching and building it yourself?

Yes, that is my intention. I'd prefer to merge the changes into the upstream so that it is easier to work on clients. And maybe in the future, the new algorithm can be one of the choices or even the default choice in popular torrent software.

What do you mean by "stop leeching peers"? downloading without uploading anything is a natural part of the protocol.
What I suspect you're really looking for are ways to improve your download rate by tweaking the selection of peers you unchoke, and when.

No I'm not looking at improving my download rate. I'm looking to stop leeching peers. For example, here in China a popular torrent software is Xunlei (also known as Thunder). It downloads from every torrent peers, but it only uploads to other Xunlei peers. I think you can see how problematic this behavior is.

We have a long qBittorrent thread discussing how to block these clients, but it has no conclusion. I think it has two reasons:

  1. The anti-leeching algorithm is actually in libtorrent, not in qBittorrent, so the qBittorrent devs are not in a good position to solve it now.
  2. People have no agreement on what is the best way to identity them and block them. One qBittorrent fork just look at the client name, but that can be spoofed easily.

So what I try to do here is enable easy experimentation of different kinds of algorithms. If libtorrent accepts my PR, then the downstream clients can try all kinds of different algorithms, or maybe qBittorrent can supply a WebAPI for people to experiment. When we have enough empirical evidence on the efficacy of them, we can make the best one official in qBittorrent or even libtorrent.

It's a long way, and it may not garner enough popularity, but I want to try. Right now some people or trackers have chosen to block all Chinese IPs because of the abusive behavior of Xunlei, so basically I'm a victim of collateral damage.