userver icon indicating copy to clipboard operation
userver copied to clipboard

Implement asynchronous uTorrent protocol

Open apolukhin opened this issue 3 years ago • 5 comments

apolukhin avatar Dec 23 '22 13:12 apolukhin

@apolukhin, I will take this issue

eparoshin avatar Jul 24 '24 15:07 eparoshin

@eparoshin how is it going? Do you have some implemented features/drafts?

alex-aparin avatar Oct 20 '25 20:10 alex-aparin

@segoon @apolukhin This is quite interesting feature, could you please provide some details needed for the first prototype. Bittorent is quite big beast and additional details would help to implement the strong foundation for future extends Here are several questions:

  1. Bittorrent protocol can use different transports, like TCP and uTP. As I understand from the issue, uTP is the recommended transport to implement firstly?
  2. What about support of torrent files, magnet links? Is torrent file support enough for first prototype?
  3. What about support of DHT? Is it required for prototype?
  4. What about bittorent libraries, Is there any preferences? Is existed library recommended way?
  5. What about implementation "from scratch"? Instead of trying to adatp existed solutions will you receive self written solution based on your asyncronius engine? It may cost for support of your team in future features/updations of bittorent protocol
  6. What are chances for the solution to be merged into your project? It seems a little bit exotic, will not it be removed in future like not necessary feature/fifth wheel?

alex-aparin avatar Nov 03 '25 10:11 alex-aparin

Great to hear that you're ready to implement it!

1-3 We're open to any scope of implementation. Ideally, fully implemented protocol, but it's OK if it is added step by step (RFC by RFC? feature by feature?) 4-5 I haven't looked at existing torrent implementations. It's much better to re-use existing protocol implementation that is IO-agnostic (e.g. you manage IO/timer and pass data to/from protocol parser implementation). 6 It depends on the implementation quality. We have multiple levels of driver support. If you unsure, you may implement the driver as a completely separate git repository with instructions how to include it, and we'll gladly reference it from userver documentation as an external project with a driver impl.

segoon avatar Nov 05 '25 12:11 segoon

I did small research about existing implementations, the most popular one is libtorrent. But I am not sure whether it's easy way to integrate into userver. Library is highly coupled with boost.asio (io_context etc objects). On own behalf library spawns additional threads (at least 3), for file system, control thread, for torrents downloading. As I understand it's fully different network engine, which cannot be easily replaced by userver one (which uses libev as I understand)

alex-aparin avatar Nov 08 '25 07:11 alex-aparin