frostwire / frostwire-jlibtorrent

A swig Java interface for libtorrent by the makers of FrostWire. Develop libtorrent based apps with the joy of coding in Java.
http://www.frostwire.com
MIT License
451 stars 138 forks source link

[Android][1.2.0.6] Downloads remain at 0% #162

Closed proninyaroslav closed 7 years ago

proninyaroslav commented 7 years ago

Hello. After the upgrade to 1.2.0.6, there were problems with downloading. Details here https://github.com/proninyaroslav/libretorrent/issues/79

aldenml commented 7 years ago

I will need more information, we are not experience this problem in our clients. Do you mind trying 1.2.0.7-RC3?

proninyaroslav commented 7 years ago

Ok, i will be try 1.2.0.7-RC3.

proninyaroslav commented 7 years ago

I tested a new version and still get this behavior. My steps to reproduce the problem:

  1. Add torrent
  2. After adding download doesn't take place. Removing and adding again doesn't always help
  3. Reboot the app
  4. After that downloading takes place. Even if I delete the torrent and add it again I don't need reboot
mianharisali commented 7 years ago

yes , some times i face this same issue , i occurs randomly. sometimes downloading starts and some times it does not start. same goes for fetch magnet , some time it fetches magnet quickly some times it timeouts a lot.

proninyaroslav commented 7 years ago

I revealed the pattern of this problem: this problem occurs only for those torrents that have been added using magnet links. With .torrent files this doesn't happen.

aldenml commented 7 years ago

Ok, now we are talking :) can you point me to a source code link in github where I can see the relevant logic?

proninyaroslav commented 7 years ago

Code for downloading magnet here https://github.com/proninyaroslav/libretorrent/blob/master/app/src/main/java/org/proninyaroslav/libretorrent/core/TorrentFetcher.java . Before updating to 1.2.0.6, I did not make any changes to the logic's work. I just updated lib to this version and this problem appeared.

aldenml commented 7 years ago

I'm telling you, you need to stop creating a SessionManager for fetchMagnet, you are creating a session every time, and that mess with the DHT. I improved the code there, try to use SessionManager as a singleton and let me know.

proninyaroslav commented 7 years ago

Yes, you told me about this problem, but I don't think that this affects the lack of trackers.

aldenml commented 7 years ago

You are right, the lack of trackers is another problem, but I encourage you to change the code as soon as possible.

In any case, you need to remember that info-dicts stored in the DHT (the one retrieved via magnets) does not store the trackers. You have the trackers (and other parameters) in the magnet link url. If you want to retrieve all that information merged in the return of SessionManager#fetchManget, use the override with the parameter extra=true.

public byte[] fetchMagnet(String uri, int timeout, boolean extra);
public byte[] fetchMagnet(String uri, int timeout, final boolean extra, final int maxSize);
proninyaroslav commented 7 years ago

Ok, I will reorganize code and try changing call to the fetchMagnet.

gubatron commented 7 years ago

any luck @proninyaroslav ?

mianharisali commented 7 years ago

@gubatron i am not facing this problem anymore.

aldenml commented 7 years ago

good to know!