mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 13:18:06 -06:00
Address some issues regarding private torrents
This commit is contained in:
@@ -287,6 +287,7 @@ namespace BitTorrent
|
||||
virtual void addUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
||||
virtual void removeUrlSeeds(const QVector<QUrl> &urlSeeds) = 0;
|
||||
virtual bool connectPeer(const PeerAddress &peerAddress) = 0;
|
||||
virtual void clearPeers() = 0;
|
||||
|
||||
virtual QString createMagnetURI() const = 0;
|
||||
|
||||
|
||||
@@ -432,6 +432,11 @@ void TorrentHandleImpl::replaceTrackers(const QVector<TrackerEntry> &trackers)
|
||||
|
||||
if (!newTrackers.isEmpty())
|
||||
m_session->handleTorrentTrackersAdded(this, newTrackers);
|
||||
|
||||
// Clear the peer list if it's a private torrent since
|
||||
// we do not want to keep connecting with peers from old tracker.
|
||||
if (isPrivate())
|
||||
clearPeers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,6 +491,13 @@ void TorrentHandleImpl::removeUrlSeeds(const QVector<QUrl> &urlSeeds)
|
||||
m_session->handleTorrentUrlSeedsRemoved(this, removedUrlSeeds);
|
||||
}
|
||||
|
||||
void TorrentHandleImpl::clearPeers()
|
||||
{
|
||||
#if (LIBTORRENT_VERSION_NUM >= 10207)
|
||||
m_nativeHandle.clear_peers();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TorrentHandleImpl::connectPeer(const PeerAddress &peerAddress)
|
||||
{
|
||||
lt::error_code ec;
|
||||
|
||||
@@ -237,6 +237,7 @@ namespace BitTorrent
|
||||
void addUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
||||
void removeUrlSeeds(const QVector<QUrl> &urlSeeds) override;
|
||||
bool connectPeer(const PeerAddress &peerAddress) override;
|
||||
void clearPeers() override;
|
||||
|
||||
QString createMagnetURI() const override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user