mpetazzoni / ttorrent

BitTorrent Java library with tracker and download client
http://mpetazzoni.github.com/ttorrent/
Apache License 2.0
1.38k stars 502 forks source link

Server, client to behave weird if an announced torrent contains only empty files #234

Open mbait opened 5 years ago

mbait commented 5 years ago

If a torrent contains only empty files, then the generated .torrent file won't open in Transmission (nothing happens, no "new torrent" dialog appears after selecting the file in the open file dialog). When I try to download the torrent with the means of ttorrent (SimpleClient.downloadTorrent()) it finishes, leaving .part-files for every file in the torrent. Adding a single byte to any file in the torrent and re-generating and re-announcing the torrent solves the problem: everything is downloaded correctly and the .torrent-file is opened in Transmission as expected. Perhaps, the issues is related to #233.

Dead-off commented 5 years ago

Thank you, i'll look at this issue and your previous issue next week!

Dead-off commented 5 years ago

i didn't find something about empty files in torrent protocol documentation. Also Qbittorrent client hangs with empty torrent file too. Looks like i can add check for this case and just throw some exception. Is it okay or you have other solution?

mbait commented 5 years ago

I don't know the essence of the BitTorrent protocol so I may be wrong, but from what I've already learnt it seems that BT should have no problem handling empty files: the path is present and SHA1 still cab be computed). In my application I worked around this issue even before reporting, so it's up to you whether to close it or to leave for further investigation, I just wanted to share because I also contribute to FOSS as a developer and know how important user reports can be. And, by the way, thank you for looking into this!