mafintosh / torrent-stream

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

Hash doesn't match on big torrents #69

Closed jung35 closed 10 years ago

jung35 commented 10 years ago

I've been playing around with this and I came across where once I downloaded a .torrent file for a big download it will not start downloading. I checked to see what was making this problem and found out the hashes do not seem to match.

So far I test low as 3.87GiB (4157627274 Bytes)

mafintosh commented 10 years ago

could you expand on what you mean by hashes not matching?

jung35 commented 10 years ago

So right over here https://github.com/mafintosh/torrent-stream/blob/master/index.js#L588 After the torrent is parsed and sent to encode, it skips over this if statement https://github.com/mafintosh/torrent-stream/blob/master/lib%2Fencode-metadata.js#L38

and then the script just closes

mafintosh commented 10 years ago

@jung3o could you email me the torrent file that is causing this? mathiasbuus@gmail.com

mafintosh commented 10 years ago

This was indeed a bug in torrent-stream. It turns out some torrents include non-standard properties which caused the info-hash to be wrong when we parsed+reencoded it.

A fix for this is released in 0.13.2. Could you try upgrading to this version and try again?

/cc @asapach @galedric in case you are wondering about 0b293f2

jung35 commented 10 years ago

Just tested it, it works now. Thanks!

asapach commented 10 years ago

@mafintosh, that's a breaking change: t-s used to accept parsed torrent object (via magnet-uri or read-torrent) and now it doesn't.

mafintosh commented 10 years ago

@asapach oh yea sorry - should have been a minor bump (wasn't documented though). if an object is passed we could just encode it to a buffer to support the old behavior as well.

asapach commented 10 years ago

I don't mind treating it the same way as magnet-uri: just use the infoHash and fetch the metadata from peers.

mafintosh commented 10 years ago

@asapach fine by me - will you add or should I?

asapach commented 10 years ago

I might screw it up, you'll do it better :)

mafintosh commented 10 years ago

@asapach should be fixed in 0.13.3 :)

asapach commented 10 years ago

Thanks

mysoogal commented 10 years ago

thanks for the fix