fix default file pool size on windows

This commit is contained in:
arvidn 2017-03-09 19:26:19 -05:00 committed by Arvid Norberg
parent 5cb12318c5
commit dec8c853e3
3 changed files with 4 additions and 12 deletions

View File

@ -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

View File

@ -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()

View File

@ -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));