rakshasa / libtorrent

libTorrent BitTorrent library
http://rtorrent.net/downloads/
GNU General Public License v2.0
883 stars 210 forks source link

Ensure files starting on a new piece aren't marked complete twice #245

Open kannibalox opened 10 months ago

kannibalox commented 10 months ago

Fixes https://github.com/rakshasa/rtorrent/issues/1248

stickz commented 9 months ago

This pull request has a regression where completion on the file list is reported as less than 100% when completed.

kannibalox commented 9 months ago

Is there any further information you can provide? The size and order of the files in question and the piece size would be great. I tried a bunch of things, including setting some of the files to "off" priority, but was unable to reproduce.

Edit: Was able to reproduce, will dig in

kannibalox commented 9 months ago

That should cover all cases, including zero-length files, but I'll do further testing and maybe even take a stab at unit tests to prove it out.

stickz commented 9 months ago

Thanks. I'm working on pushing some of these fixes to various vendors. I backported changes from jesec as well.

stickz commented 7 months ago

This pull request is still broken. Here's an example where the file completion percentage reports incorrectly. https://github.com/swizzin/swizzin/issues/1106

Running the same code with a patch. https://github.com/swizzin/swizzin/blob/master/sources/patches/rtorrent/piece-boundary-fix-0.13.8.patch

kannibalox commented 7 months ago

Very strange, I made sure to test what this condition at least looks to be and it functions correctly, I'll have to find a way to reproduce it.