Closed monkeyWie closed 11 months ago
Thanks for the contribution. This really needs some tests. I'm also not sure about allocating a roaring bitmap to perform this. Are we sure there's not just a simple error in the existing function?
I've had time to think about this carefully. This is a pretty good solution. On the boundary pieces, it is actually possible to figure out if dirty chunks belong to the file or not. I see that you don't do this, but you do apply a limit to ensure that the dirty chunk attribution doesn't exceed the amount of the file that is inside the boundary piece. It would take me quite a while to patch it up to handle the chunk attribution to be 100% correct, so I will merge this as you have it, and accept or add the last mile if it comes up again.
I do note the existing tests don't do any special dirty chunk treatment, it would be nice to augment the tests a bit to handle this too.
fixed https://github.com/anacrolix/torrent/issues/851.