Browse Source

Make qBittorrent compatible with libtorrent master

PR #17604.
adaptive-webui-19844
Vladimir Golovnev 2 years ago committed by GitHub
parent
commit
794a92f911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/base/bittorrent/sessionimpl.cpp
  2. 5
      src/base/bittorrent/torrentinfo.cpp

6
src/base/bittorrent/sessionimpl.cpp

@ -1416,7 +1416,13 @@ void SessionImpl::initializeNativeSession()
break; break;
} }
#endif #endif
#if LIBTORRENT_VERSION_NUM < 20100
m_nativeSession = new lt::session(sessionParams, lt::session::paused); m_nativeSession = new lt::session(sessionParams, lt::session::paused);
#else
m_nativeSession = new lt::session(sessionParams);
m_nativeSession->pause();
#endif
LogMsg(tr("Peer ID: \"%1\"").arg(QString::fromStdString(peerId)), Log::INFO); LogMsg(tr("Peer ID: \"%1\"").arg(QString::fromStdString(peerId)), Log::INFO);
LogMsg(tr("HTTP User-Agent: \"%1\"").arg(USER_AGENT), Log::INFO); LogMsg(tr("HTTP User-Agent: \"%1\"").arg(USER_AGENT), Log::INFO);

5
src/base/bittorrent/torrentinfo.cpp

@ -30,6 +30,7 @@
#include <libtorrent/create_torrent.hpp> #include <libtorrent/create_torrent.hpp>
#include <libtorrent/error_code.hpp> #include <libtorrent/error_code.hpp>
#include <libtorrent/version.hpp>
#include <QByteArray> #include <QByteArray>
#include <QDateTime> #include <QDateTime>
@ -292,8 +293,12 @@ QVector<QUrl> TorrentInfo::urlSeeds() const
for (const lt::web_seed_entry &webSeed : nativeWebSeeds) for (const lt::web_seed_entry &webSeed : nativeWebSeeds)
{ {
#if LIBTORRENT_VERSION_NUM < 20100
if (webSeed.type == lt::web_seed_entry::url_seed) if (webSeed.type == lt::web_seed_entry::url_seed)
urlSeeds.append(QUrl(QString::fromStdString(webSeed.url))); urlSeeds.append(QUrl(QString::fromStdString(webSeed.url)));
#else
urlSeeds.append(QUrl(QString::fromStdString(webSeed.url)));
#endif
} }
return urlSeeds; return urlSeeds;

Loading…
Cancel
Save