diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 5fa4cb699..0c2a6cbb7 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -1086,18 +1086,6 @@ void SessionImpl::setGlobalMaxSeedingMinutes(int minutes) } } -void SessionImpl::adjustLimits() -{ - if (isQueueingSystemEnabled()) - { - lt::settings_pack settingsPack; - // Internally increase the queue limits to ensure that the magnet is started - settingsPack.set_int(lt::settings_pack::active_downloads, adjustLimit(maxActiveDownloads())); - settingsPack.set_int(lt::settings_pack::active_limit, adjustLimit(maxActiveTorrents())); - m_nativeSession->apply_settings(std::move(settingsPack)); - } -} - void SessionImpl::applyBandwidthLimits() { lt::settings_pack settingsPack; @@ -1540,16 +1528,6 @@ void SessionImpl::processBannedIPs(lt::ip_filter &filter) } } -int SessionImpl::adjustLimit(const int limit) const -{ - if (limit <= -1) - return limit; - // check for overflow: (limit + m_extraLimit) < std::numeric_limits::max() - return (m_extraLimit < (std::numeric_limits::max() - limit)) - ? (limit + m_extraLimit) - : std::numeric_limits::max(); -} - void SessionImpl::initMetrics() { const auto findMetricIndex = [](const char *name) -> int @@ -1751,10 +1729,8 @@ lt::settings_pack SessionImpl::loadLTSettings() const // Queueing System if (isQueueingSystemEnabled()) { - // Internally increase the queue limits to ensure that the magnet is started - settingsPack.set_int(lt::settings_pack::active_downloads, adjustLimit(maxActiveDownloads())); - settingsPack.set_int(lt::settings_pack::active_limit, adjustLimit(maxActiveTorrents())); - + settingsPack.set_int(lt::settings_pack::active_downloads, maxActiveDownloads()); + settingsPack.set_int(lt::settings_pack::active_limit, maxActiveTorrents()); settingsPack.set_int(lt::settings_pack::active_seeds, maxActiveUploads()); settingsPack.set_bool(lt::settings_pack::dont_count_slow_torrents, ignoreSlowTorrentsForQueueing()); settingsPack.set_int(lt::settings_pack::inactive_down_rate, downloadRateForSlowTorrents() * 1024); // KiB to Bytes @@ -2333,8 +2309,6 @@ bool SessionImpl::cancelDownloadMetadata(const TorrentID &id) } #endif m_downloadedMetadata.erase(downloadedMetadataIter); - --m_extraLimit; - adjustLimits(); m_nativeSession->remove_torrent(nativeHandle, lt::session::delete_files); return true; } @@ -5212,9 +5186,6 @@ void SessionImpl::handleAddTorrentAlerts(const std::vector &alerts) else if (const auto downloadedMetadataIter = m_downloadedMetadata.find(torrentID) ; downloadedMetadataIter != m_downloadedMetadata.end()) { - ++m_extraLimit; - adjustLimits(); - downloadedMetadataIter.value() = alert->handle; if (infoHash.isHybrid()) { @@ -5493,9 +5464,6 @@ void SessionImpl::handleMetadataReceivedAlert(const lt::metadata_received_alert if (found) { const TorrentInfo metadata {*p->handle.torrent_file()}; - - --m_extraLimit; - adjustLimits(); m_nativeSession->remove_torrent(p->handle, lt::session::delete_files); emit metadataDownloaded(metadata); diff --git a/src/base/bittorrent/sessionimpl.h b/src/base/bittorrent/sessionimpl.h index e1df5ce81..a6de23091 100644 --- a/src/base/bittorrent/sessionimpl.h +++ b/src/base/bittorrent/sessionimpl.h @@ -492,9 +492,7 @@ namespace BitTorrent lt::settings_pack loadLTSettings() const; void applyNetworkInterfacesSettings(lt::settings_pack &settingsPack) const; void configurePeerClasses(); - int adjustLimit(int limit) const; void initMetrics(); - void adjustLimits(); void applyBandwidthLimits(); void processBannedIPs(lt::ip_filter &filter); QStringList getListeningIPs() const; @@ -686,7 +684,6 @@ namespace BitTorrent const bool m_wasPexEnabled = m_isPeXEnabled; int m_numResumeData = 0; - int m_extraLimit = 0; QVector m_additionalTrackerList; QVector m_excludedFileNamesRegExpList;