Browse Source

Add send_buffer_watermark send_buffer_low_watermark

send_buffer_watermark_factor knobs
adaptive-webui-19844
Chocobo1 7 years ago
parent
commit
f4be165767
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 50
      src/base/bittorrent/session.cpp
  2. 9
      src/base/bittorrent/session.h
  3. 23
      src/gui/advancedsettings.cpp
  4. 3
      src/gui/advancedsettings.h

50
src/base/bittorrent/session.cpp

@ -265,6 +265,9 @@ Session::Session(QObject *parent) @@ -265,6 +265,9 @@ Session::Session(QObject *parent)
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
, m_guidedReadCacheEnabled(BITTORRENT_SESSION_KEY("GuidedReadCache"), true)
, m_isSuggestMode(BITTORRENT_SESSION_KEY("SuggestMode"), false)
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
, m_sendBufferWatermarkFactor(BITTORRENT_SESSION_KEY("SendBufferWatermarkFactor"), 50)
, m_isAnonymousModeEnabled(BITTORRENT_SESSION_KEY("AnonymousModeEnabled"), false)
, m_isQueueingEnabled(BITTORRENT_SESSION_KEY("QueueingSystemEnabled"), true)
, m_maxActiveDownloads(BITTORRENT_SESSION_KEY("MaxActiveDownloads"), 3, lowerLimited(-1))
@ -1263,6 +1266,10 @@ void Session::configure(libtorrent::settings_pack &settingsPack) @@ -1263,6 +1266,10 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
settingsPack.set_bool(libt::settings_pack::guided_read_cache, isGuidedReadCacheEnabled());
settingsPack.set_bool(libt::settings_pack::suggest_mode, isSuggestModeEnabled());
settingsPack.set_int(libt::settings_pack::send_buffer_watermark, sendBufferWatermark() * 1024);
settingsPack.set_int(libt::settings_pack::send_buffer_low_watermark, sendBufferLowWatermark() * 1024);
settingsPack.set_int(libt::settings_pack::send_buffer_watermark_factor, sendBufferWatermarkFactor());
settingsPack.set_bool(libt::settings_pack::anonymous_mode, isAnonymousModeEnabled());
// Queueing System
@ -1500,6 +1507,10 @@ void Session::configure(libtorrent::session_settings &sessionSettings) @@ -1500,6 +1507,10 @@ void Session::configure(libtorrent::session_settings &sessionSettings)
sessionSettings.guided_read_cache = isGuidedReadCacheEnabled();
sessionSettings.suggest_mode = isSuggestModeEnabled();
sessionSettings.send_buffer_watermark = sendBufferWatermark() * 1024;
sessionSettings.send_buffer_low_watermark = sendBufferLowWatermark() * 1024;
sessionSettings.send_buffer_watermark_factor = sendBufferWatermarkFactor();
sessionSettings.anonymous_mode = isAnonymousModeEnabled();
// Queueing System
@ -2942,6 +2953,45 @@ void Session::setSuggestMode(bool mode) @@ -2942,6 +2953,45 @@ void Session::setSuggestMode(bool mode)
configureDeferred();
}
int Session::sendBufferWatermark() const
{
return m_sendBufferWatermark;
}
void Session::setSendBufferWatermark(int value)
{
if (value == m_sendBufferWatermark) return;
m_sendBufferWatermark = value;
configureDeferred();
}
int Session::sendBufferLowWatermark() const
{
return m_sendBufferLowWatermark;
}
void Session::setSendBufferLowWatermark(int value)
{
if (value == m_sendBufferLowWatermark) return;
m_sendBufferLowWatermark = value;
configureDeferred();
}
int Session::sendBufferWatermarkFactor() const
{
return m_sendBufferWatermarkFactor;
}
void Session::setSendBufferWatermarkFactor(int value)
{
if (value == m_sendBufferWatermarkFactor) return;
m_sendBufferWatermarkFactor = value;
configureDeferred();
}
bool Session::isAnonymousModeEnabled() const
{
return m_isAnonymousModeEnabled;

9
src/base/bittorrent/session.h

@ -341,6 +341,12 @@ namespace BitTorrent @@ -341,6 +341,12 @@ namespace BitTorrent
void setGuidedReadCacheEnabled(bool enabled);
bool isSuggestModeEnabled() const;
void setSuggestMode(bool mode);
int sendBufferWatermark() const;
void setSendBufferWatermark(int value);
int sendBufferLowWatermark() const;
void setSendBufferLowWatermark(int value);
int sendBufferWatermarkFactor() const;
void setSendBufferWatermarkFactor(int value);
bool isAnonymousModeEnabled() const;
void setAnonymousModeEnabled(bool enabled);
bool isQueueingSystemEnabled() const;
@ -589,6 +595,9 @@ namespace BitTorrent @@ -589,6 +595,9 @@ namespace BitTorrent
CachedSettingValue<bool> m_useOSCache;
CachedSettingValue<bool> m_guidedReadCacheEnabled;
CachedSettingValue<bool> m_isSuggestMode;
CachedSettingValue<int> m_sendBufferWatermark;
CachedSettingValue<int> m_sendBufferLowWatermark;
CachedSettingValue<int> m_sendBufferWatermarkFactor;
CachedSettingValue<bool> m_isAnonymousModeEnabled;
CachedSettingValue<bool> m_isQueueingEnabled;
CachedSettingValue<int> m_maxActiveDownloads;

23
src/gui/advancedsettings.cpp

@ -80,6 +80,9 @@ enum AdvSettingsRows @@ -80,6 +80,9 @@ enum AdvSettingsRows
OS_CACHE,
GUIDED_READ_CACHE,
SUGGEST_MODE,
SEND_BUF_WATERMARK,
SEND_BUF_LOW_WATERMARK,
SEND_BUF_WATERMARK_FACTOR,
// ports
MAX_HALF_OPEN,
OUTGOING_PORT_MIN,
@ -137,6 +140,10 @@ void AdvancedSettings::saveAdvancedSettings() @@ -137,6 +140,10 @@ void AdvancedSettings::saveAdvancedSettings()
session->setGuidedReadCacheEnabled(cbGuidedReadCache.isChecked());
// Suggest mode
session->setSuggestMode(cbSuggestMode.isChecked());
// Send buffer watermark
session->setSendBufferWatermark(spinSendBufferWatermark.value());
session->setSendBufferLowWatermark(spinSendBufferLowWatermark.value());
session->setSendBufferWatermarkFactor(spinSendBufferWatermarkFactor.value());
// Save resume data interval
session->setSaveResumeDataInterval(spin_save_resume_data_interval.value());
// Outgoing ports
@ -303,6 +310,22 @@ void AdvancedSettings::loadAdvancedSettings() @@ -303,6 +310,22 @@ void AdvancedSettings::loadAdvancedSettings()
// Suggest mode
cbSuggestMode.setChecked(session->isSuggestModeEnabled());
addRow(SUGGEST_MODE, tr("Send upload piece suggestions"), &cbSuggestMode);
// Send buffer watermark
spinSendBufferWatermark.setMinimum(1);
spinSendBufferWatermark.setMaximum(INT_MAX);
spinSendBufferWatermark.setSuffix(tr(" KiB"));
spinSendBufferWatermark.setValue(session->sendBufferWatermark());
addRow(SEND_BUF_WATERMARK, tr("Send buffer watermark"), &spinSendBufferWatermark);
spinSendBufferLowWatermark.setMinimum(1);
spinSendBufferLowWatermark.setMaximum(INT_MAX);
spinSendBufferLowWatermark.setSuffix(tr(" KiB"));
spinSendBufferLowWatermark.setValue(session->sendBufferLowWatermark());
addRow(SEND_BUF_LOW_WATERMARK, tr("Send buffer low watermark"), &spinSendBufferLowWatermark);
spinSendBufferWatermarkFactor.setMinimum(1);
spinSendBufferWatermarkFactor.setMaximum(INT_MAX);
spinSendBufferWatermarkFactor.setSuffix(" %");
spinSendBufferWatermarkFactor.setValue(session->sendBufferWatermarkFactor());
addRow(SEND_BUF_WATERMARK_FACTOR, tr("Send buffer watermark factor"), &spinSendBufferWatermarkFactor);
// Save resume data interval
spin_save_resume_data_interval.setMinimum(1);
spin_save_resume_data_interval.setMaximum(1440);

3
src/gui/advancedsettings.h

@ -75,7 +75,8 @@ private: @@ -75,7 +75,8 @@ private:
template <typename T> void addRow(int row, const QString &rowText, T* widget);
QLabel labelQbtLink, labelLibtorrentLink;
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port, spin_cache_ttl;
QSpinBox spin_cache, spin_save_resume_data_interval, outgoing_ports_min, outgoing_ports_max, spin_list_refresh, spin_maxhalfopen, spin_tracker_port, spin_cache_ttl,
spinSendBufferWatermark, spinSendBufferLowWatermark, spinSendBufferWatermarkFactor;
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, cbMultiConnectionsPerIp,

Loading…
Cancel
Save