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:
Sophist 2020-08-15 19:29:30 +02:00
parent e1d097a92d
commit 4c37c229d9
6 changed files with 127 additions and 1 deletions

View file

@ -322,6 +322,10 @@ void AppController::preferencesAction()
data["announce_ip"] = session->announceIP();
// Stop tracker timeout
data["stop_tracker_timeout"] = session->stopTrackerTimeout();
// Peer Turnover
data["peer_turnover"] = session->peerTurnover();
data["peer_turnover_cutoff"] = session->peerTurnoverCutoff();
data["peer_turnover_interval"] = session->peerTurnoverInterval();
setResult(data);
}
@ -768,6 +772,13 @@ void AppController::setPreferencesAction()
// Stop tracker timeout
if (hasKey("stop_tracker_timeout"))
session->setStopTrackerTimeout(it.value().toInt());
// Peer Turnover
if (hasKey("peer_turnover"))
session->setPeerTurnover(it.value().toInt());
if (hasKey("peer_turnover_cutoff"))
session->setPeerTurnoverCutoff(it.value().toInt());
if (hasKey("peer_turnover_interval"))
session->setPeerTurnoverInterval(it.value().toInt());
// Save preferences
pref->apply();