Allow setting the number of maximum active checking torrents

This is to allow re-checking of multiple torrents simultaneously. This will benefit users who
have multiple disks or SSD.
Closes #15296.

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
This commit is contained in:
An0n 2022-02-27 20:08:10 +06:00 committed by Chocobo1
parent 889d994dbc
commit 801cfdbc24
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
7 changed files with 75 additions and 1 deletions

View file

@ -450,6 +450,7 @@ Session::Session(QObject *parent)
, m_networkInterfaceName(BITTORRENT_SESSION_KEY("InterfaceName"))
, m_networkInterfaceAddress(BITTORRENT_SESSION_KEY("InterfaceAddress"))
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0)
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY("MaxActiveCheckingTorrents"), 1)
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY("ProxyPeerConnections"), false)
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), ChokingAlgorithm::FixedSlots
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
@ -1287,6 +1288,8 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
settingsPack.set_int(lt::settings_pack::in_enc_policy, lt::settings_pack::pe_disabled);
}
settingsPack.set_int(lt::settings_pack::active_checking, maxActiveCheckingTorrents());
// proxy
const auto proxyManager = Net::ProxyConfigurationManager::instance();
const Net::ProxyConfiguration proxyConfig = proxyManager->proxyConfiguration();
@ -2985,6 +2988,20 @@ void Session::setEncryption(const int state)
}
}
int Session::maxActiveCheckingTorrents() const
{
return m_maxActiveCheckingTorrents;
}
void Session::setMaxActiveCheckingTorrents(const int val)
{
if (val == m_maxActiveCheckingTorrents)
return;
m_maxActiveCheckingTorrents = val;
configureDeferred();
}
bool Session::isProxyPeerConnectionsEnabled() const
{
return m_isProxyPeerConnectionsEnabled;