mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Add mixed_mode_algorithm knob
This commit is contained in:
parent
6150e0c56b
commit
4185209036
@ -283,6 +283,7 @@ Session::Session(QObject *parent)
|
||||
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY("MaxUploadsPerTorrent"), -1, lowerLimited(0, -1))
|
||||
, m_isUTPEnabled(BITTORRENT_SESSION_KEY("uTPEnabled"), true)
|
||||
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY("uTPRateLimited"), true)
|
||||
, m_utpMixedMode(BITTORRENT_SESSION_KEY("uTPMixedMode"), m_isUTPEnabled)
|
||||
, m_isAddTrackersEnabled(BITTORRENT_SESSION_KEY("AddTrackersEnabled"), false)
|
||||
, m_additionalTrackers(BITTORRENT_SESSION_KEY("AdditionalTrackers"))
|
||||
, m_globalMaxRatio(BITTORRENT_SESSION_KEY("GlobalMaxRatio"), -1, [](qreal r) { return r < 0 ? -1. : r;})
|
||||
@ -1299,9 +1300,15 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
|
||||
// uTP
|
||||
settingsPack.set_bool(libt::settings_pack::enable_incoming_utp, isUTPEnabled());
|
||||
settingsPack.set_bool(libt::settings_pack::enable_outgoing_utp, isUTPEnabled());
|
||||
settingsPack.set_int(libt::settings_pack::mixed_mode_algorithm, isUTPRateLimited()
|
||||
? libt::settings_pack::prefer_tcp
|
||||
: libt::settings_pack::peer_proportional);
|
||||
switch (utpMixedMode()) {
|
||||
case 0:
|
||||
default:
|
||||
settingsPack.set_int(libt::settings_pack::mixed_mode_algorithm, libt::settings_pack::prefer_tcp);
|
||||
break;
|
||||
case 1:
|
||||
settingsPack.set_int(libt::settings_pack::mixed_mode_algorithm, libt::settings_pack::peer_proportional);
|
||||
break;
|
||||
}
|
||||
|
||||
settingsPack.set_bool(libt::settings_pack::apply_ip_filter_to_trackers, isTrackerFilteringEnabled());
|
||||
|
||||
@ -1521,9 +1528,15 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
|
||||
sessionSettings.enable_outgoing_utp = isUTPEnabled();
|
||||
// uTP rate limiting
|
||||
sessionSettings.rate_limit_utp = isUTPRateLimited();
|
||||
sessionSettings.mixed_mode_algorithm = isUTPRateLimited()
|
||||
? libt::session_settings::prefer_tcp
|
||||
: libt::session_settings::peer_proportional;
|
||||
switch (utpMixedMode()) {
|
||||
case 0:
|
||||
default:
|
||||
sessionSettings.mixed_mode_algorithm = libt::session_settings::prefer_tcp;
|
||||
break;
|
||||
case 1:
|
||||
sessionSettings.mixed_mode_algorithm = libt::session_settings::peer_proportional;
|
||||
break;
|
||||
}
|
||||
|
||||
sessionSettings.apply_ip_filter_to_trackers = isTrackerFilteringEnabled();
|
||||
|
||||
@ -3090,6 +3103,19 @@ void Session::setUTPRateLimited(bool limited)
|
||||
}
|
||||
}
|
||||
|
||||
int Session::utpMixedMode() const
|
||||
{
|
||||
return m_utpMixedMode;
|
||||
}
|
||||
|
||||
void Session::setUtpMixedMode(int mode)
|
||||
{
|
||||
if (mode == m_utpMixedMode) return;
|
||||
|
||||
m_utpMixedMode = mode;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
bool Session::isTrackerFilteringEnabled() const
|
||||
{
|
||||
return m_isTrackerFilteringEnabled;
|
||||
|
@ -373,6 +373,8 @@ namespace BitTorrent
|
||||
void setUTPEnabled(bool enabled);
|
||||
bool isUTPRateLimited() const;
|
||||
void setUTPRateLimited(bool limited);
|
||||
int utpMixedMode() const;
|
||||
void setUtpMixedMode(int mode);
|
||||
bool isTrackerFilteringEnabled() const;
|
||||
void setTrackerFilteringEnabled(bool enabled);
|
||||
QStringList bannedIPs() const;
|
||||
@ -597,6 +599,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_maxUploadsPerTorrent;
|
||||
CachedSettingValue<bool> m_isUTPEnabled;
|
||||
CachedSettingValue<bool> m_isUTPRateLimited;
|
||||
CachedSettingValue<int> m_utpMixedMode;
|
||||
CachedSettingValue<bool> m_isAddTrackersEnabled;
|
||||
CachedSettingValue<QString> m_additionalTrackers;
|
||||
CachedSettingValue<qreal> m_globalMaxRatio;
|
||||
|
@ -83,6 +83,7 @@ enum AdvSettingsRows
|
||||
MAX_HALF_OPEN,
|
||||
OUTGOING_PORT_MIN,
|
||||
OUTGOING_PORT_MAX,
|
||||
UTP_MIX_MODE,
|
||||
// embedded tracker
|
||||
TRACKER_STATUS,
|
||||
TRACKER_PORT,
|
||||
@ -135,6 +136,8 @@ void AdvancedSettings::saveAdvancedSettings()
|
||||
// Outgoing ports
|
||||
session->setOutgoingPortsMin(outgoing_ports_min.value());
|
||||
session->setOutgoingPortsMax(outgoing_ports_max.value());
|
||||
// uTP-TCP mixed mode
|
||||
session->setUtpMixedMode(comboUtpMixedMode.currentIndex());
|
||||
// Recheck torrents on completion
|
||||
pref->recheckTorrentsOnCompletion(cb_recheck_completed.isChecked());
|
||||
// Transfer list refresh interval
|
||||
@ -300,6 +303,10 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||
outgoing_ports_max.setMaximum(65535);
|
||||
outgoing_ports_max.setValue(session->outgoingPortsMax());
|
||||
addRow(OUTGOING_PORT_MAX, tr("Outgoing ports (Max) [0: Disabled]"), &outgoing_ports_max);
|
||||
// uTP-TCP mixed mode
|
||||
comboUtpMixedMode.addItems({"Prefer TCP", "Peer proportional (throttles TCP)"});
|
||||
comboUtpMixedMode.setCurrentIndex(session->utpMixedMode());
|
||||
addRow(UTP_MIX_MODE, tr("uTP-TCP mixed mode algorithm"), &comboUtpMixedMode);
|
||||
// Recheck completed torrents
|
||||
cb_recheck_completed.setChecked(pref->recheckTorrentsOnCompletion());
|
||||
addRow(RECHECK_COMPLETED, tr("Recheck torrents on completion"), &cb_recheck_completed);
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, cb_super_seeding,
|
||||
cb_program_notifications, cb_torrent_added_notifications, cb_tracker_favicon, cb_tracker_status,
|
||||
cb_confirm_torrent_recheck, cb_confirm_remove_all_tags, cb_listen_ipv6, cb_announce_all_trackers, cbGuidedReadCache;
|
||||
QComboBox combo_iface, combo_iface_address;
|
||||
QComboBox combo_iface, combo_iface_address, comboUtpMixedMode;
|
||||
QLineEdit txtAnnounceIP;
|
||||
|
||||
// OS dependent settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user