Browse Source

Add "Coalesce reads & writes" checkbox in advanced options

The setting is defaulted to ON for Windows. Closes #8295.
adaptive-webui-19844
Chocobo1 7 years ago
parent
commit
543cbc6d1c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 22
      src/base/bittorrent/session.cpp
  2. 3
      src/base/bittorrent/session.h
  3. 8
      src/gui/advancedsettings.cpp
  4. 2
      src/gui/advancedsettings.h

22
src/base/bittorrent/session.cpp

@ -280,6 +280,11 @@ Session::Session(QObject *parent) @@ -280,6 +280,11 @@ Session::Session(QObject *parent)
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
, m_guidedReadCacheEnabled(BITTORRENT_SESSION_KEY("GuidedReadCache"), true)
#ifdef Q_OS_WIN
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY("CoalesceReadWrite"), true)
#else
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY("CoalesceReadWrite"), false)
#endif
, m_isSuggestMode(BITTORRENT_SESSION_KEY("SuggestMode"), false)
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
@ -1303,6 +1308,10 @@ void Session::configure(libtorrent::settings_pack &settingsPack) @@ -1303,6 +1308,10 @@ void Session::configure(libtorrent::settings_pack &settingsPack)
settingsPack.set_int(libt::settings_pack::disk_io_read_mode, mode);
settingsPack.set_int(libt::settings_pack::disk_io_write_mode, mode);
settingsPack.set_bool(libt::settings_pack::guided_read_cache, isGuidedReadCacheEnabled());
settingsPack.set_bool(libt::settings_pack::coalesce_reads, isCoalesceReadWriteEnabled());
settingsPack.set_bool(libt::settings_pack::coalesce_writes, isCoalesceReadWriteEnabled());
settingsPack.set_int(libt::settings_pack::suggest_mode, isSuggestModeEnabled()
? libt::settings_pack::suggest_read_cache : libt::settings_pack::no_piece_suggestions);
@ -3049,6 +3058,19 @@ void Session::setGuidedReadCacheEnabled(bool enabled) @@ -3049,6 +3058,19 @@ void Session::setGuidedReadCacheEnabled(bool enabled)
configureDeferred();
}
bool Session::isCoalesceReadWriteEnabled() const
{
return m_coalesceReadWriteEnabled;
}
void Session::setCoalesceReadWriteEnabled(bool enabled)
{
if (enabled == m_coalesceReadWriteEnabled) return;
m_coalesceReadWriteEnabled = enabled;
configureDeferred();
}
bool Session::isSuggestModeEnabled() const
{
return m_isSuggestMode;

3
src/base/bittorrent/session.h

@ -382,6 +382,8 @@ namespace BitTorrent @@ -382,6 +382,8 @@ namespace BitTorrent
void setUseOSCache(bool use);
bool isGuidedReadCacheEnabled() const;
void setGuidedReadCacheEnabled(bool enabled);
bool isCoalesceReadWriteEnabled() const;
void setCoalesceReadWriteEnabled(bool enabled);
bool isSuggestModeEnabled() const;
void setSuggestMode(bool mode);
int sendBufferWatermark() const;
@ -646,6 +648,7 @@ namespace BitTorrent @@ -646,6 +648,7 @@ namespace BitTorrent
CachedSettingValue<int> m_diskCacheTTL;
CachedSettingValue<bool> m_useOSCache;
CachedSettingValue<bool> m_guidedReadCacheEnabled;
CachedSettingValue<bool> m_coalesceReadWriteEnabled;
CachedSettingValue<bool> m_isSuggestMode;
CachedSettingValue<int> m_sendBufferWatermark;
CachedSettingValue<int> m_sendBufferLowWatermark;

8
src/gui/advancedsettings.cpp

@ -82,6 +82,7 @@ enum AdvSettingsRows @@ -82,6 +82,7 @@ enum AdvSettingsRows
DISK_CACHE_TTL,
OS_CACHE,
GUIDED_READ_CACHE,
COALESCE_RW,
SUGGEST_MODE,
SEND_BUF_WATERMARK,
SEND_BUF_LOW_WATERMARK,
@ -142,6 +143,8 @@ void AdvancedSettings::saveAdvancedSettings() @@ -142,6 +143,8 @@ void AdvancedSettings::saveAdvancedSettings()
session->setUseOSCache(cb_os_cache.isChecked());
// Guided read cache
session->setGuidedReadCacheEnabled(cbGuidedReadCache.isChecked());
// Coalesce reads & writes
session->setCoalesceReadWriteEnabled(cbCoalesceRW.isChecked());
// Suggest mode
session->setSuggestMode(cbSuggestMode.isChecked());
// Send buffer watermark
@ -313,6 +316,11 @@ void AdvancedSettings::loadAdvancedSettings() @@ -313,6 +316,11 @@ void AdvancedSettings::loadAdvancedSettings()
// Guided read cache
cbGuidedReadCache.setChecked(session->isGuidedReadCacheEnabled());
addRow(GUIDED_READ_CACHE, tr("Guided read cache"), &cbGuidedReadCache);
// Coalesce reads & writes
cbCoalesceRW.setChecked(session->isCoalesceReadWriteEnabled());
#if LIBTORRENT_VERSION_NUM >= 10107
addRow(COALESCE_RW, tr("Coalesce reads & writes"), &cbCoalesceRW);
#endif
// Suggest mode
cbSuggestMode.setChecked(session->isSuggestModeEnabled());
addRow(SUGGEST_MODE, tr("Send upload piece suggestions"), &cbSuggestMode);

2
src/gui/advancedsettings.h

@ -80,7 +80,7 @@ private: @@ -80,7 +80,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, cb_announce_all_tiers,
cbGuidedReadCache, cbMultiConnectionsPerIp, cbSuggestMode;
cbGuidedReadCache, cbMultiConnectionsPerIp, cbSuggestMode, cbCoalesceRW;
QComboBox combo_iface, combo_iface_address, comboUtpMixedMode, comboChokingAlgorithm, comboSeedChokingAlgorithm;
QLineEdit txtAnnounceIP;

Loading…
Cancel
Save