WinPooh32 / peerstohttp

Simple torrent proxy to http stream controlled over REST-like api
GNU General Public License v3.0
46 stars 10 forks source link

Delegate magnet URI handling to torrent.AddMagnet instead of processing TorrentSpec. #23

Closed pataquets closed 2 years ago

pataquets commented 2 years ago

Instead of converting metainfo into TorrentSpec for no gain, just pass the magnet URI directly to torrent.AddMagnet() to do the whole processing. If the spec changes later, current code should track new object members to avoid leaving any behind (as already happens).

Steps to reproduce an existing problem

Currently, passing the BEP9 x.pe magnet URI query param is not working/ignored. You can see this better with rarely found torrents, poorly known in trackers and DHTs. The rarest the torrent, the better to reproduce.

Now try again with current PR branch. You'll see the torrent debug messages adding the provided peer IP and the server contacting it to instantly download the metadata info, fullfilling the request.