Closed masterwok closed 5 years ago
is this still an issue after our 1.2.1.0 release? https://github.com/frostwire/frostwire-jlibtorrent/releases/tag/release%2F1.2.1.0
I'm facing similar issue; getting TORRENT_FINISHED
twice same as described in the OP. However I see this behavior on only one specific torrent only, with a web torrent haven't checked the behavior on magnet link. I'm also calling resume after I receive an ADD_TORRENT
alert.
If you want I can post the torrent link here, it is one of the copyright content and I remember, in another post I saw reluctance to accept/post copyright torrents.
I wonder if you could write a test for it and submit a pull request, that way we could replicate it easily and perhaps track down why this alert is being fired twice. Maybe in the test you are not able to replicate the problem and then you'll be able to track down the issue to your own bittorrent client.
Maybe something like DoubleTorrentFinishedAlertIssue220Test.java
in https://github.com/frostwire/frostwire-jlibtorrent/tree/master/src/test/java/com/frostwire/jlibtorrent
Can I add the torrent link? As I mentioned it is a copyright torrent.
Sorry for the late reply I had a broken hand.
Please do not. Ideally if there is a bug, it should happen with any torrent or a similar torrent. You should try to understand what is different about that torrent, what the pieces are like.
A fix from libtorrent 1.2.8 might help with this issue:
fixed issue where pop_alerts() could return old, invalid alerts
Hello,
I'm seeing the torrent finished alert being emitted twice when working with magnets.
The first emitted finished event is occurring directly after ADD_TORRENT alert is emitted. The second event is occurring when the torrent download completes.
I believe the extra event is emitted due to how I'm "forcing" magnets to start in my code by invoking resume on the torrent handle. My reason for doing so is that when I start a download with a magnet using the SessionManager the ADD_TORRENT alert is emitted but the download never starts. I'm seeing the following in my logs:
The only way I was able to get the download to start is by invoking resume on the torrent handle when the ADD_TORRENT alert is emitted. Doing so solves the issue where the magnet would not start, but it seems to have the unintended side effect of emitting a TORRENT_FINISHED alert. I'm almost positive this is where the problem occurs as I'm probably messing up some internal state somewhere.
I also want to add that I'm waiting for the DHT to initialize before starting the magnet download so I don't believe that's the cause of the issue.
I'm sure the solution to this problem is simple but I'm not sure what I'm missing. I would expect that once the DHT is initialized and download is invoked on the session manager using a magnet that the download would start and continue until completion.
The forced resume I mentioned can be seen here.
There is also a sample project in that repository. The issue can be reproduced by commenting out the line here, removing the resume invocation, and starting the download of the magnet.
Any advice would be greatly appreciated :)!