From dec8c853e3b6454e6ff485c64130a7e33325ca99 Mon Sep 17 00:00:00 2001 From: arvidn Date: Thu, 9 Mar 2017 19:26:19 -0500 Subject: [PATCH] fix default file pool size on windows --- ChangeLog | 1 + src/disk_io_thread.cpp | 9 --------- src/session_impl.cpp | 6 +++--- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45552b0d9..f54e84cba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + * fix default file pool size on windows * fix bug where settings_pack::file_pool_size setting was not being honored * add feature to periodically close files (to make windows clear disk cache) * fix bug in torrent_handle::file_status diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index f5812984c..10261aaf5 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -163,15 +163,6 @@ namespace libtorrent error_code ec; m_disk_cache.set_settings(m_settings, ec); TORRENT_ASSERT(!ec); - - // deduct some margin for epoll/kqueue, log files, - // futexes, shared objects etc. - // 80% of the available file descriptors should go to connections - // 20% goes towards regular files - const int max_files = std::min((std::max)(5 - , (max_open_files() - 20) * 2 / 10) - , m_file_pool.size_limit()); - m_file_pool.resize(max_files); } disk_io_thread::~disk_io_thread() diff --git a/src/session_impl.cpp b/src/session_impl.cpp index a088dc7ca..ae5fa93ce 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -520,13 +520,13 @@ namespace aux { #endif // TORRENT_DISABLE_LOGGING // ---- auto-cap max connections ---- - int max_files = max_open_files(); + int const max_files = max_open_files(); // deduct some margin for epoll/kqueue, log files, // futexes, shared objects etc. // 80% of the available file descriptors should go to connections - m_settings.set_int(settings_pack::connections_limit, (std::min)( + m_settings.set_int(settings_pack::connections_limit, std::min( m_settings.get_int(settings_pack::connections_limit) - , (std::max)(5, (max_files - 20) * 8 / 10))); + , std::max(5, (max_files - 20) * 8 / 10))); // 20% goes towards regular files (see disk_io_thread) #ifndef TORRENT_DISABLE_LOGGING session_log(" max connections: %d", m_settings.get_int(settings_pack::connections_limit));