mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 21:52:32 -06: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:
@@ -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();
|
||||
|
||||
@@ -1161,6 +1161,30 @@
|
||||
<input type="text" id="stopTrackerTimeout" style="width: 15em;" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="peerTurnover">QBT_TR(Peer turnover disconnect percentage:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#peer_turnover" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="peerTurnover" style="width: 15em;" /> %
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="peerTurnoverCutoff">QBT_TR(Peer turnover threshold percentage:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#peer_turnover" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="peerTurnoverCutoff" style="width: 15em;" /> %
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="peerTurnoverInterval">QBT_TR(Peer turnover disconnect interval:)QBT_TR[CONTEXT=OptionsDialog] <a href="https://www.libtorrent.org/reference-Settings.html#peer_turnover" target="_blank">(?)</a></label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="peerTurnoverInterval" style="width: 15em;" /> s
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -1863,6 +1887,9 @@
|
||||
$('announceAllTiers').setProperty('checked', pref.announce_to_all_tiers);
|
||||
$('announceIP').setProperty('value', pref.announce_ip);
|
||||
$('stopTrackerTimeout').setProperty('value', pref.stop_tracker_timeout);
|
||||
$('peerTurnover').setProperty('value', pref.peer_turnover);
|
||||
$('peerTurnoverCutoff').setProperty('value', pref.peer_turnover_cutoff);
|
||||
$('peerTurnoverInterval').setProperty('value', pref.peer_turnover_interval);
|
||||
}
|
||||
}
|
||||
}).send();
|
||||
@@ -2245,6 +2272,9 @@
|
||||
settings.set('announce_to_all_tiers', $('announceAllTiers').getProperty('checked'));
|
||||
settings.set('announce_ip', $('announceIP').getProperty('value'));
|
||||
settings.set('stop_tracker_timeout', $('stopTrackerTimeout').getProperty('value'));
|
||||
settings.set('peer_turnover', $('peerTurnover').getProperty('value'));
|
||||
settings.set('peer_turnover_cutoff', $('peerTurnoverCutoff').getProperty('value'));
|
||||
settings.set('peer_turnover_interval', $('peerTurnoverInterval').getProperty('value'));
|
||||
|
||||
// Send it to qBT
|
||||
const json_str = JSON.encode(settings);
|
||||
|
||||
Reference in New Issue
Block a user