Browse Source

Add "File pool size" option

adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
ed2199b91c
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 17
      src/base/bittorrent/session.cpp
  2. 3
      src/base/bittorrent/session.h
  3. 10
      src/gui/advancedsettings.cpp
  4. 3
      src/gui/advancedsettings.h

17
src/base/bittorrent/session.cpp

@ -268,6 +268,7 @@ Session::Session(QObject *parent) @@ -268,6 +268,7 @@ Session::Session(QObject *parent)
, m_announceToAllTrackers(BITTORRENT_SESSION_KEY("AnnounceToAllTrackers"), false)
, m_announceToAllTiers(BITTORRENT_SESSION_KEY("AnnounceToAllTiers"), true)
, m_asyncIOThreads(BITTORRENT_SESSION_KEY("AsyncIOThreadsCount"), 4)
, m_filePoolSize(BITTORRENT_SESSION_KEY("FilePoolSize"), 40)
, m_checkingMemUsage(BITTORRENT_SESSION_KEY("CheckingMemUsageSize"), 16)
, m_diskCacheSize(BITTORRENT_SESSION_KEY("DiskCacheSize"), 64)
, m_diskCacheTTL(BITTORRENT_SESSION_KEY("DiskCacheTTL"), 60)
@ -1255,6 +1256,8 @@ void Session::configure(lt::settings_pack &settingsPack) @@ -1255,6 +1256,8 @@ void Session::configure(lt::settings_pack &settingsPack)
settingsPack.set_int(lt::settings_pack::aio_threads, asyncIOThreads());
settingsPack.set_int(lt::settings_pack::file_pool_size, filePoolSize());
const int checkingMemUsageSize = checkingMemUsage() * 64;
settingsPack.set_int(lt::settings_pack::checking_mem_usage, checkingMemUsageSize);
@ -2814,6 +2817,20 @@ void Session::setAsyncIOThreads(const int num) @@ -2814,6 +2817,20 @@ void Session::setAsyncIOThreads(const int num)
configureDeferred();
}
int Session::filePoolSize() const
{
return m_filePoolSize;
}
void Session::setFilePoolSize(const int size)
{
if (size == m_filePoolSize)
return;
m_filePoolSize = size;
configureDeferred();
}
int Session::checkingMemUsage() const
{
return qMax(1, m_checkingMemUsage.value());

3
src/base/bittorrent/session.h

@ -320,6 +320,8 @@ namespace BitTorrent @@ -320,6 +320,8 @@ namespace BitTorrent
void setAnnounceToAllTiers(bool val);
int asyncIOThreads() const;
void setAsyncIOThreads(int num);
int filePoolSize() const;
void setFilePoolSize(int size);
int checkingMemUsage() const;
void setCheckingMemUsage(int size);
int diskCacheSize() const;
@ -587,6 +589,7 @@ namespace BitTorrent @@ -587,6 +589,7 @@ namespace BitTorrent
CachedSettingValue<bool> m_announceToAllTrackers;
CachedSettingValue<bool> m_announceToAllTiers;
CachedSettingValue<int> m_asyncIOThreads;
CachedSettingValue<int> m_filePoolSize;
CachedSettingValue<int> m_checkingMemUsage;
CachedSettingValue<int> m_diskCacheSize;
CachedSettingValue<int> m_diskCacheTTL;

10
src/gui/advancedsettings.cpp

@ -89,6 +89,7 @@ enum AdvSettingsRows @@ -89,6 +89,7 @@ enum AdvSettingsRows
// libtorrent section
LIBTORRENT_HEADER,
ASYNC_IO_THREADS,
FILE_POOL_SIZE,
CHECKING_MEM_USAGE,
// cache
DISK_CACHE,
@ -155,6 +156,8 @@ void AdvancedSettings::saveAdvancedSettings() @@ -155,6 +156,8 @@ void AdvancedSettings::saveAdvancedSettings()
// Async IO threads
session->setAsyncIOThreads(spinBoxAsyncIOThreads.value());
// File pool size
session->setFilePoolSize(spinBoxFilePoolSize.value());
// Checking Memory Usage
session->setCheckingMemUsage(spinBoxCheckingMemUsage.value());
// Disk write cache
@ -328,6 +331,13 @@ void AdvancedSettings::loadAdvancedSettings() @@ -328,6 +331,13 @@ void AdvancedSettings::loadAdvancedSettings()
addRow(ASYNC_IO_THREADS, (tr("Asynchronous I/O threads") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#aio_threads", "(?)"))
, &spinBoxAsyncIOThreads);
// File pool size
spinBoxFilePoolSize.setMinimum(1);
spinBoxFilePoolSize.setMaximum(std::numeric_limits<int>::max());
spinBoxFilePoolSize.setValue(session->filePoolSize());
addRow(FILE_POOL_SIZE, (tr("File pool size") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#file_pool_size", "(?)"))
, &spinBoxFilePoolSize);
// Checking Memory Usage
spinBoxCheckingMemUsage.setMinimum(1);
// When build as 32bit binary, set the maximum value lower to prevent crashes.

3
src/gui/advancedsettings.h

@ -59,7 +59,8 @@ private: @@ -59,7 +59,8 @@ private:
template <typename T> void addRow(int row, const QString &text, T *widget);
QLabel labelQbtLink, labelLibtorrentLink;
QSpinBox spinBoxAsyncIOThreads, spinBoxCheckingMemUsage, spinBoxCache, spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
QSpinBox spinBoxAsyncIOThreads, spinBoxFilePoolSize, spinBoxCheckingMemUsage, spinBoxCache,
spinBoxSaveResumeDataInterval, spinBoxOutgoingPortsMin, spinBoxOutgoingPortsMax, spinBoxListRefresh,
spinBoxTrackerPort, spinBoxCacheTTL, spinBoxSendBufferWatermark, spinBoxSendBufferLowWatermark,
spinBoxSendBufferWatermarkFactor, spinBoxSocketBacklogSize, spinBoxSavePathHistoryLength;
QCheckBox checkBoxOsCache, checkBoxRecheckCompleted, checkBoxResolveCountries, checkBoxResolveHosts, checkBoxSuperSeeding,

Loading…
Cancel
Save