mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 02:27:09 -07:00
Expose LibTorrent peer_turnover settings
This PR exposes the LibTorrent Peer Turnover Settings in qBT Advanced Settings in order to allow users to adjust how frequently slow and uninteresting connections are closed to allow potentially better / faster connections to be made. The default settings are to turnover peers when the number of connections is at least 90% of allowed global or per torrent connections, and to disconnect the least attractive 4% of these connections every 5 minutes. See https://www.libtorrent.org/reference-Settings.html#peer_turnover
This commit is contained in:
parent
e1d097a92d
commit
4c37c229d9
6 changed files with 127 additions and 1 deletions
|
@ -375,6 +375,9 @@ Session::Session(QObject *parent)
|
|||
, m_isDisableAutoTMMWhenDefaultSavePathChanged(BITTORRENT_SESSION_KEY("DisableAutoTMMTriggers/DefaultSavePathChanged"), true)
|
||||
, m_isDisableAutoTMMWhenCategorySavePathChanged(BITTORRENT_SESSION_KEY("DisableAutoTMMTriggers/CategorySavePathChanged"), true)
|
||||
, m_isTrackerEnabled(BITTORRENT_KEY("TrackerEnabled"), false)
|
||||
, m_peerTurnover(BITTORRENT_SESSION_KEY("PeerTurnover"), 4)
|
||||
, m_peerTurnoverCutoff(BITTORRENT_SESSION_KEY("PeerTurnoverCutOff"), 90)
|
||||
, m_peerTurnoverInterval(BITTORRENT_SESSION_KEY("PeerTurnoverInterval"), 300)
|
||||
, m_bannedIPs("State/BannedIPs"
|
||||
, QStringList()
|
||||
, [](const QStringList &value)
|
||||
|
@ -1208,6 +1211,10 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
|
|||
settingsPack.set_bool(lt::settings_pack::announce_to_all_trackers, announceToAllTrackers());
|
||||
settingsPack.set_bool(lt::settings_pack::announce_to_all_tiers, announceToAllTiers());
|
||||
|
||||
settingsPack.set_int(lt::settings_pack::peer_turnover, peerTurnover());
|
||||
settingsPack.set_int(lt::settings_pack::peer_turnover_cutoff, peerTurnoverCutoff());
|
||||
settingsPack.set_int(lt::settings_pack::peer_turnover_interval, peerTurnoverInterval());
|
||||
|
||||
settingsPack.set_int(lt::settings_pack::aio_threads, asyncIOThreads());
|
||||
settingsPack.set_int(lt::settings_pack::file_pool_size, filePoolSize());
|
||||
|
||||
|
@ -2934,6 +2941,48 @@ void Session::setAnnounceToAllTiers(const bool val)
|
|||
}
|
||||
}
|
||||
|
||||
int Session::peerTurnover() const
|
||||
{
|
||||
return m_peerTurnover;
|
||||
}
|
||||
|
||||
void Session::setPeerTurnover(const int val)
|
||||
{
|
||||
if (val == m_peerTurnover)
|
||||
return;
|
||||
|
||||
m_peerTurnover = val;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
int Session::peerTurnoverCutoff() const
|
||||
{
|
||||
return m_peerTurnoverCutoff;
|
||||
}
|
||||
|
||||
void Session::setPeerTurnoverCutoff(const int val)
|
||||
{
|
||||
if (val == m_peerTurnoverCutoff)
|
||||
return;
|
||||
|
||||
m_peerTurnoverCutoff = val;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
int Session::peerTurnoverInterval() const
|
||||
{
|
||||
return m_peerTurnoverInterval;
|
||||
}
|
||||
|
||||
void Session::setPeerTurnoverInterval(const int val)
|
||||
{
|
||||
if (val == m_peerTurnoverInterval)
|
||||
return;
|
||||
|
||||
m_peerTurnoverInterval = val;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
int Session::asyncIOThreads() const
|
||||
{
|
||||
return qBound(1, m_asyncIOThreads.value(), 1024);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue