libtorrent icon indicating copy to clipboard operation
libtorrent copied to clipboard

Completed on doesn't update if the file is completed again

Open xanatos opened this issue 2 years ago • 4 comments

libtorrent version (or branch): 2.0.9.0

platform/architecture: Windows

compiler and compiler version: Not relevant

If a torrent is completed, then "damaged" in some way (a file is removed, or bitrot ruins a file), then rechecked (so that the library notices the torrent isn't complete anymore), then completed again, the Completed on date isn't updated with the "newer" completion date (I think it is called m_completed_time by the library). So the Completed on date is the date of "first" completion, while I think it should be the date of "last" completion, so that you can see which torrents were completed in the last few hours/few days.

I think I've tracked the problem to:

https://github.com/arvidn/libtorrent/blob/RC_2_0/src/torrent.cpp#L8365

Initially I had opened the bug report to the qBittorrent project, but they told me that this is controlled by the libtorrent library: https://github.com/qbittorrent/qBittorrent/issues/19510

xanatos avatar Aug 28 '23 07:08 xanatos

I agree with your expected behavior, it would make sense. I don't think it's entirely trivial to get there though.

Off the top of my head, I suspect the reason that check is there is that, every time a torrent is added to the session in a completed state, that function is called.

i.e. there's no distinction between downloading a piece that completes the torrent, and adding a torrent to the session that's already completed. Both cases end up taking that code path to set the torrent into the "finished" state.

arvidn avatar Sep 03 '23 11:09 arvidn

actually, maybe clearing that field whenever we're not finished might just do it

arvidn avatar Sep 04 '23 06:09 arvidn