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

Trackers List is Empty if torrent is added using magnet uri. #136

Closed mianharisali closed 7 years ago

mianharisali commented 7 years ago

I tried every thing but the tracker list is empty if torrent is added using magnet uri. you can test it on this open source project.

https://github.com/proninyaroslav/libretorrent

may be this issue is related to following issue.

https://github.com/frostwire/frostwire/issues/294

aldenml commented 7 years ago

I doubt this is the same problem. Can you give me a link to the source code I can see how to you retrieve the tracker list?

mianharisali commented 7 years ago
    @Override
    public Set<String> getTrackersUrl()
    {
        List<AnnounceEntry> trackers = th.trackers();
        Set<String> urls = new HashSet<>(trackers.size());

        for (AnnounceEntry entry : trackers) {
            urls.add(entry.url());
        }

        return urls;
    }
mianharisali commented 7 years ago

https://github.com/proninyaroslav/libretorrent/blob/master/app/src/main/java/org/proninyaroslav/libretorrent/core/TorrentDownload.java

aldenml commented 7 years ago

You know, I just found the same flaw in our client, but there is nothing wrong with jlibtorrent, it does what's supposed to do, if you fetch magnet, it returns the info-dict from the DHT, and that info does not include trackers. You need parse the magnet link and enhance your TorrentInfo, that I assume you decode from the data returned from fetchMagnet.

aldenml commented 7 years ago

I need to confirm this

aldenml commented 7 years ago

yes, confirmed, internally in libtorrent the trackers are not added to the torrent info used to create the info-dict data, and that's ok

aldenml commented 7 years ago

Ok, in the next release (soon) you will be able to call SessionManager#fetchMagnet(String uri, int timeout, boolean extra) and it will give you the trackers.

https://github.com/frostwire/frostwire-jlibtorrent/commit/a7ffefe20e7cbf3dd051df5b0a8fa41de0e11a13#diff-4084b7d645fedef72ebfe253b83e773fR613

mianharisali commented 7 years ago

@aldenml thats awesome (Y)