mafintosh / torrent-stream

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

torrent-stream doesn't preserve announce list when saving metadata #47

Open asapach opened 10 years ago

asapach commented 10 years ago

When saving torrent metadata to the tmp file, announce or announce-list fields from a .torrent or tr parameter from a magnet are being discarded.

https://github.com/mafintosh/torrent-stream/blob/4e841174dd04da0e171d31ffcbd94a8bc0e5df4b/index.js#L533

klesun commented 4 years ago

real talk real talk! Here is an example:

magnet:?xt=urn:btih:7257749eebb543a03b2d7bee2c87d12f649d1316&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce

When you paste it in qbittorrent, it gets 30 seeds, but when I feed it to torrent-stream, it hangs inedinitely, never firing the metadata event. Same hang happens in qbittorrent if you remove the tr announce urls from the links.

I take it that some torrents can not be downloaded without explicit announces. This one is from ny**.si, btw, an archive of manga named Yotsuba To.

klesun commented 4 years ago

Just read the docs, found this parameter:

trackers: [
    'udp://tracker.openbittorrent.com:80',
    'udp://tracker.ccc.de:80'
],

Will try it out.

klesun commented 4 years ago

Hm, there is also this parameter:

    tracker: true,        // Whether or not to use trackers from torrent file or magnet link
                          // Defaults to true

Said to be true by default, hm...

klesun commented 4 years ago

Nah, none of the parameters helped, none of the events fired. One curious thing though is that if I wait 10 seconds and console.log engine.swarm, I see that there is a decent amount of connections: 22 unique ip addresses in engine.swarm._peers

klesun commented 4 years ago

Hm, webtorrent does not seem to download this torrent either with noPeers event. Guess it'll stay a mystery how desktop clients manage to download this stuff...

klesun commented 4 years ago

Ok, my torrent problem is not related to tr - tr does work, I'm even getting _peers that are ready to send me data:

"amInterested": false,
"peerChoking": false,

But ready event never fires nevertheless. I start to suspect something unexpected happens on transport level due to japanese unicode characters in the name: よつばと! 第01-14巻 [Yotsuba to ! vol 01-14], though other torrents from same tracker with such characters work fine...

Will be digging further, if I ever get knowledgeable enough to find the cause, I'll submit a PR or something ;)