fix bug in auto disk cache size logic
This commit is contained in:
parent
71e3bee54d
commit
6c880159c9
|
@ -1,3 +1,4 @@
|
|||
* fix bug in auto disk cache size logic
|
||||
* fix issue with outgoing_interfaces setting, where bind() would be called twice
|
||||
* add build option to disable share-mode
|
||||
* support validation of HTTPS trackers
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace aux {
|
|||
, aux::session_settings_single_thread& sett
|
||||
, std::vector<void(aux::session_impl::*)()>* callbacks = nullptr);
|
||||
TORRENT_EXTRA_EXPORT void run_all_updates(aux::session_impl& ses);
|
||||
TORRENT_EXTRA_EXPORT int default_int_value(int const name);
|
||||
|
||||
// converts a setting integer (from the enums string_types, int_types or
|
||||
// bool_types) to a string, and vice versa.
|
||||
|
|
|
@ -292,7 +292,7 @@ namespace libtorrent {
|
|||
if (cache_size < 0)
|
||||
{
|
||||
std::int64_t phys_ram = total_physical_ram();
|
||||
if (phys_ram == 0) m_max_use = 1024;
|
||||
if (phys_ram == 0) m_max_use = default_int_value(settings_pack::cache_size);
|
||||
else
|
||||
{
|
||||
// this is the logic to calculate the automatic disk cache size
|
||||
|
|
|
@ -112,7 +112,7 @@ namespace libtorrent {
|
|||
MEMORYSTATUSEX ms;
|
||||
ms.dwLength = sizeof(MEMORYSTATUSEX);
|
||||
if (GlobalMemoryStatusEx(&ms))
|
||||
ret = int(ms.ullTotalPhys);
|
||||
ret = ms.ullTotalPhys;
|
||||
else
|
||||
ret = 0;
|
||||
#elif defined TORRENT_LINUX
|
||||
|
|
|
@ -531,6 +531,12 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
|
|||
return ret;
|
||||
}
|
||||
|
||||
int default_int_value(int const name)
|
||||
{
|
||||
TORRENT_ASSERT((name & settings_pack::type_mask) == settings_pack::int_type_base);
|
||||
return int_settings[name - settings_pack::int_type_base].default_value;
|
||||
}
|
||||
|
||||
void apply_pack(settings_pack const* pack, aux::session_settings& sett
|
||||
, aux::session_impl* ses)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue