From e331db077ca1e2f1ef5657f12272bb9651e661c9 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Fri, 26 Aug 2022 07:20:21 +0300 Subject: [PATCH] Fix missing trackers from magnet link PR #17606. --- src/base/bittorrent/session.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index ece6f6ee8..c19d68348 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -4915,7 +4915,14 @@ void Session::handleMetadataReceivedAlert(const lt::metadata_received_alert *p) if (downloadedMetadataIter != m_downloadedMetadata.end()) { +#if LIBTORRENT_VERSION_NUM >= 20007 + lt::torrent_info nativeInfo = *p->handle.torrent_file(); + for (const lt::announce_entry &announceEntry : p->handle.trackers()) + nativeInfo.add_tracker(announceEntry.url, announceEntry.tier); + const TorrentInfo metadata {nativeInfo}; +#else const TorrentInfo metadata {*p->handle.torrent_file()}; +#endif m_downloadedMetadata.erase(downloadedMetadataIter); --m_extraLimit;