mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-26 11:16:20 +03:00
Merge pull request #8336 from Chocobo1/coalesce
Add "Coalesce reads & writes" checkbox in advanced options
This commit is contained in:
commit
882fa7ecd4
4 changed files with 34 additions and 1 deletions
|
@ -280,6 +280,11 @@ Session::Session(QObject *parent)
|
||||||
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
|
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
|
||||||
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
|
, m_useOSCache(BITTORRENT_SESSION_KEY("UseOSCache"), true)
|
||||||
, m_guidedReadCacheEnabled(BITTORRENT_SESSION_KEY("GuidedReadCache"), 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_isSuggestMode(BITTORRENT_SESSION_KEY("SuggestMode"), false)
|
||||||
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
|
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
|
||||||
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
|
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
|
||||||
|
@ -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_read_mode, mode);
|
||||||
settingsPack.set_int(libt::settings_pack::disk_io_write_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::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()
|
settingsPack.set_int(libt::settings_pack::suggest_mode, isSuggestModeEnabled()
|
||||||
? libt::settings_pack::suggest_read_cache : libt::settings_pack::no_piece_suggestions);
|
? libt::settings_pack::suggest_read_cache : libt::settings_pack::no_piece_suggestions);
|
||||||
|
|
||||||
|
@ -3049,6 +3058,19 @@ void Session::setGuidedReadCacheEnabled(bool enabled)
|
||||||
configureDeferred();
|
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
|
bool Session::isSuggestModeEnabled() const
|
||||||
{
|
{
|
||||||
return m_isSuggestMode;
|
return m_isSuggestMode;
|
||||||
|
|
|
@ -382,6 +382,8 @@ namespace BitTorrent
|
||||||
void setUseOSCache(bool use);
|
void setUseOSCache(bool use);
|
||||||
bool isGuidedReadCacheEnabled() const;
|
bool isGuidedReadCacheEnabled() const;
|
||||||
void setGuidedReadCacheEnabled(bool enabled);
|
void setGuidedReadCacheEnabled(bool enabled);
|
||||||
|
bool isCoalesceReadWriteEnabled() const;
|
||||||
|
void setCoalesceReadWriteEnabled(bool enabled);
|
||||||
bool isSuggestModeEnabled() const;
|
bool isSuggestModeEnabled() const;
|
||||||
void setSuggestMode(bool mode);
|
void setSuggestMode(bool mode);
|
||||||
int sendBufferWatermark() const;
|
int sendBufferWatermark() const;
|
||||||
|
@ -646,6 +648,7 @@ namespace BitTorrent
|
||||||
CachedSettingValue<int> m_diskCacheTTL;
|
CachedSettingValue<int> m_diskCacheTTL;
|
||||||
CachedSettingValue<bool> m_useOSCache;
|
CachedSettingValue<bool> m_useOSCache;
|
||||||
CachedSettingValue<bool> m_guidedReadCacheEnabled;
|
CachedSettingValue<bool> m_guidedReadCacheEnabled;
|
||||||
|
CachedSettingValue<bool> m_coalesceReadWriteEnabled;
|
||||||
CachedSettingValue<bool> m_isSuggestMode;
|
CachedSettingValue<bool> m_isSuggestMode;
|
||||||
CachedSettingValue<int> m_sendBufferWatermark;
|
CachedSettingValue<int> m_sendBufferWatermark;
|
||||||
CachedSettingValue<int> m_sendBufferLowWatermark;
|
CachedSettingValue<int> m_sendBufferLowWatermark;
|
||||||
|
|
|
@ -82,6 +82,7 @@ enum AdvSettingsRows
|
||||||
DISK_CACHE_TTL,
|
DISK_CACHE_TTL,
|
||||||
OS_CACHE,
|
OS_CACHE,
|
||||||
GUIDED_READ_CACHE,
|
GUIDED_READ_CACHE,
|
||||||
|
COALESCE_RW,
|
||||||
SUGGEST_MODE,
|
SUGGEST_MODE,
|
||||||
SEND_BUF_WATERMARK,
|
SEND_BUF_WATERMARK,
|
||||||
SEND_BUF_LOW_WATERMARK,
|
SEND_BUF_LOW_WATERMARK,
|
||||||
|
@ -142,6 +143,8 @@ void AdvancedSettings::saveAdvancedSettings()
|
||||||
session->setUseOSCache(cb_os_cache.isChecked());
|
session->setUseOSCache(cb_os_cache.isChecked());
|
||||||
// Guided read cache
|
// Guided read cache
|
||||||
session->setGuidedReadCacheEnabled(cbGuidedReadCache.isChecked());
|
session->setGuidedReadCacheEnabled(cbGuidedReadCache.isChecked());
|
||||||
|
// Coalesce reads & writes
|
||||||
|
session->setCoalesceReadWriteEnabled(cbCoalesceRW.isChecked());
|
||||||
// Suggest mode
|
// Suggest mode
|
||||||
session->setSuggestMode(cbSuggestMode.isChecked());
|
session->setSuggestMode(cbSuggestMode.isChecked());
|
||||||
// Send buffer watermark
|
// Send buffer watermark
|
||||||
|
@ -313,6 +316,11 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||||
// Guided read cache
|
// Guided read cache
|
||||||
cbGuidedReadCache.setChecked(session->isGuidedReadCacheEnabled());
|
cbGuidedReadCache.setChecked(session->isGuidedReadCacheEnabled());
|
||||||
addRow(GUIDED_READ_CACHE, tr("Guided read cache"), &cbGuidedReadCache);
|
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
|
// Suggest mode
|
||||||
cbSuggestMode.setChecked(session->isSuggestModeEnabled());
|
cbSuggestMode.setChecked(session->isSuggestModeEnabled());
|
||||||
addRow(SUGGEST_MODE, tr("Send upload piece suggestions"), &cbSuggestMode);
|
addRow(SUGGEST_MODE, tr("Send upload piece suggestions"), &cbSuggestMode);
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
QCheckBox cb_os_cache, cb_recheck_completed, cb_resolve_countries, cb_resolve_hosts, cb_super_seeding,
|
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_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,
|
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;
|
QComboBox combo_iface, combo_iface_address, comboUtpMixedMode, comboChokingAlgorithm, comboSeedChokingAlgorithm;
|
||||||
QLineEdit txtAnnounceIP;
|
QLineEdit txtAnnounceIP;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue