mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 04:38:04 -06:00
Add piece_extent_affinity to AdvancedSettings
Expose option in WebUI settings and WebAPI. Requires WebAPI version bump. Closes #11436.
This commit is contained in:
@@ -383,6 +383,7 @@ Session::Session(QObject *parent)
|
||||
#else
|
||||
, m_coalesceReadWriteEnabled(BITTORRENT_SESSION_KEY("CoalesceReadWrite"), false)
|
||||
#endif
|
||||
, m_usePieceExtentAffinity(BITTORRENT_SESSION_KEY("PieceExtentAffinity"), false)
|
||||
, m_isSuggestMode(BITTORRENT_SESSION_KEY("SuggestMode"), false)
|
||||
, m_sendBufferWatermark(BITTORRENT_SESSION_KEY("SendBufferWatermark"), 500)
|
||||
, m_sendBufferLowWatermark(BITTORRENT_SESSION_KEY("SendBufferLowWatermark"), 10)
|
||||
@@ -1323,6 +1324,10 @@ void Session::loadLTSettings(lt::settings_pack &settingsPack)
|
||||
settingsPack.set_bool(lt::settings_pack::coalesce_reads, isCoalesceReadWriteEnabled());
|
||||
settingsPack.set_bool(lt::settings_pack::coalesce_writes, isCoalesceReadWriteEnabled());
|
||||
|
||||
#if (LIBTORRENT_VERSION_NUM >= 10202)
|
||||
settingsPack.set_bool(lt::settings_pack::piece_extent_affinity, usePieceExtentAffinity());
|
||||
#endif
|
||||
|
||||
settingsPack.set_int(lt::settings_pack::suggest_mode, isSuggestModeEnabled()
|
||||
? lt::settings_pack::suggest_read_cache : lt::settings_pack::no_piece_suggestions);
|
||||
|
||||
@@ -3248,6 +3253,19 @@ bool Session::isSuggestModeEnabled() const
|
||||
return m_isSuggestMode;
|
||||
}
|
||||
|
||||
bool Session::usePieceExtentAffinity() const
|
||||
{
|
||||
return m_usePieceExtentAffinity;
|
||||
}
|
||||
|
||||
void Session::setPieceExtentAffinity(const bool enabled)
|
||||
{
|
||||
if (enabled == m_usePieceExtentAffinity) return;
|
||||
|
||||
m_usePieceExtentAffinity = enabled;
|
||||
configureDeferred();
|
||||
}
|
||||
|
||||
void Session::setSuggestMode(const bool mode)
|
||||
{
|
||||
if (mode == m_isSuggestMode) return;
|
||||
|
||||
@@ -337,6 +337,8 @@ namespace BitTorrent
|
||||
void setUseOSCache(bool use);
|
||||
bool isCoalesceReadWriteEnabled() const;
|
||||
void setCoalesceReadWriteEnabled(bool enabled);
|
||||
bool usePieceExtentAffinity() const;
|
||||
void setPieceExtentAffinity(bool enabled);
|
||||
bool isSuggestModeEnabled() const;
|
||||
void setSuggestMode(bool mode);
|
||||
int sendBufferWatermark() const;
|
||||
@@ -610,6 +612,7 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_diskCacheTTL;
|
||||
CachedSettingValue<bool> m_useOSCache;
|
||||
CachedSettingValue<bool> m_coalesceReadWriteEnabled;
|
||||
CachedSettingValue<bool> m_usePieceExtentAffinity;
|
||||
CachedSettingValue<bool> m_isSuggestMode;
|
||||
CachedSettingValue<int> m_sendBufferWatermark;
|
||||
CachedSettingValue<int> m_sendBufferLowWatermark;
|
||||
|
||||
Reference in New Issue
Block a user