arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation

Home Page:http://libtorrent.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

xanatos opened this issue · 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: qbittorrent/qBittorrent#19510

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.

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